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
Changes from 6 commits
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
18 changes: 15 additions & 3 deletions playbooks/roles/edxapp/templates/edx/app/edxapp/worker.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,31 @@

{% set edxapp_venv_bin = edxapp_venv_dir + "/bin" %}
source {{ edxapp_app_dir }}/edxapp_env
{% set executable = edxapp_venv_bin + '/celery' %}

{% if COMMON_ENABLE_NEWRELIC_APP %}
{% set executable = edxapp_venv_bin + '/newrelic-admin run-program ' + edxapp_venv_bin + '/celery' %}
{% set executable = edxapp_venv_bin + '/newrelic-admin run-program ' + executable %}

export NEW_RELIC_CONFIG_FILE="{{ edxapp_app_dir }}/newrelic.ini"
if command -v ec2metadata >/dev/null 2>&1; then
INSTANCEID=$(ec2metadata --instance-id);
HOSTNAME=$(hostname)
export NEW_RELIC_PROCESS_HOST_DISPLAY_NAME="$HOSTNAME-$INSTANCEID"
fi
{% else %}
{% set executable = edxapp_venv_bin + '/celery' %}
{% endif %}

{% if EDXAPP_DATADOG_ENABLE %}
{% set executable = edxapp_venv_bin + '/ddtrace-run ' + executable %}
export DD_TAGS=("service:edx-edxapp-{{ SERVICE_VARIANT }}-workers", "queue:{{EDX_REST_API_CLIENT_NAME}}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. I don't think array syntax will work here. I believe what we want is this:
    Suggested change
    export DD_TAGS=("service:edx-edxapp-{{ SERVICE_VARIANT }}-workers", "queue:{{EDX_REST_API_CLIENT_NAME}}")
    export DD_TAGS="service:edx-edxapp-{{ SERVICE_VARIANT }}-workers,queue:{{EDX_REST_API_CLIENT_NAME}}"
  2. Do we want edx-edxapp-VARIANT-workers, or edx-edxapp-workers-VARIANT? The latter would be a better match for what we have in New Relic.
  3. Rather than introducing a secondary use for EDX_REST_API_CLIENT_NAME can we set an environment variable in the workers.conf like EDXAPP_WORKERS_QUEUE? Otherwise we end up yoking those two features together.

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
{% endif -%}

# We exec so that celery is the child of supervisor and can be managed properly

exec {{ executable }} $@
Loading