Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add dd-trace to edxapp workers #6

Merged
merged 8 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions playbooks/roles/edxapp/templates/edx/app/edxapp/worker.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,18 @@ source {{ edxapp_app_dir }}/edxapp_env
{% if COMMON_ENABLE_NEWRELIC_APP %}
{% set executable = edxapp_venv_bin + '/newrelic-admin run-program ' + edxapp_venv_bin + '/celery' %}
timmc-edx marked this conversation as resolved.
Show resolved Hide resolved

{% if COMMON_ENABLE_DATADOG and COMMON_ENABLE_DATADOG_APP %}
connorhaugh marked this conversation as resolved.
Show resolved Hide resolved
{% set executable = edxapp_venv_bin + '/ddtrace-run ' + executable %}
export DD_TAGS=$(dd_trace_service_name)
export DD_DJANGO_USE_LEGACY_RESOURCE_FORMAT=true
# Copied from edx_django_service playbook for consistency; Datadog
# trace debug logging issue doesn't actually affect edxapp for some
# reason.
export DD_TRACE_LOG_STREAM_HANDLER=false
# Datadog's instrumentation breaks pymongo: https://github.com/edx/edx-arch-experiments/issues/580
export DD_TRACE_PYMONGO_ENABLED=false
timmc-edx marked this conversation as resolved.
Show resolved Hide resolved
{% endif -%}

export NEW_RELIC_CONFIG_FILE="{{ edxapp_app_dir }}/newrelic.ini"
if command -v ec2metadata >/dev/null 2>&1; then
INSTANCEID=$(ec2metadata --instance-id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ directory={{ edxapp_code_dir }}
stdout_logfile={{ supervisor_log_dir }}/%(program_name)s-stdout.log
stderr_logfile={{ supervisor_log_dir }}/%(program_name)s-stderr.log

command={{ edxapp_app_dir }}/worker.sh --app={{ w.service_variant }}.celery:APP worker --loglevel=info --queues=edx.{{ w.service_variant }}.core.{{ w.queue }} --hostname=edx.{{ w.service_variant }}.core.{{ w.queue }}.%%h --concurrency={{ w.concurrency }} {{ '--max-tasks-per-child ' + w.max_tasks_per_child|string if w.max_tasks_per_child is defined else '' }} {{ '--without-heartbeat' if not EDXAPP_CELERY_HEARTBEAT_ENABLED|bool else '' }} {{ '-O ' + w.prefetch_optimization if w.prefetch_optimization is defined else '' }}
command={{ edxapp_app_dir }}/worker.sh --app={{ w.service_variant }}.celery:APP worker --loglevel=info --queues=edx.{{ w.service_variant }}.core.{{ w.queue }} --hostname=edx.{{ w.service_variant }}.core.{{ w.queue }}.%%h --concurrency={{ w.concurrency }} {{ '--max-tasks-per-child ' + w.max_tasks_per_child|string if w.max_tasks_per_child is defined else '' }} {{ '--without-heartbeat' if not EDXAPP_CELERY_HEARTBEAT_ENABLED|bool else '' }} {{ '-O ' + w.prefetch_optimization if w.prefetch_optimization is defined else '' }} --dd_trace_service_name=service:edx-edxapp-{{ w.service_variant }}-workers-core-{{ w.queue }}
killasgroup=true
stopwaitsecs={{ w.stopwaitsecs | default(EDXAPP_WORKER_DEFAULT_STOPWAITSECS) }}

Expand Down
Loading