Skip to content

Commit

Permalink
feat: Support for Datadog Inferred Services at the library level (#122)
Browse files Browse the repository at this point in the history
Combined with agent changes, this will allow for unified service naming
so that we can query DB metrics for a service.

When enabled for an environment, this change will change all spans in
edxapp to use the same service name rather than integration-specific names
like `service:defaultdb`.

See edx/edx-arch-experiments#737 and
https://docs.datadoghq.com/tracing/guide/inferred-service-opt-in/?tab=python
  • Loading branch information
timmc-edx authored Dec 3, 2024
1 parent f83a562 commit c0949e8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions playbooks/roles/edxapp/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,10 @@ EDXAPP_XML_S3_KEY: !!null

EDXAPP_DATADOG_ENABLE: "{{COMMON_ENABLE_DATADOG and COMMON_ENABLE_DATADOG_APP}}"
EDXAPP_DATADOG_PROFILING_ENABLE: "{{EDXAPP_DATADOG_ENABLE and COMMON_ENABLE_DATADOG_PROFILING}}"
# Inferred Services allows for unification of service names for all
# spans in the webapp and faceting metrics by service.
# https://docs.datadoghq.com/tracing/guide/inferred-service-opt-in/?tab=python
EDXAPP_DATADOG_INFERRED_SERVICES_ENABLE: false
# ddtrace 2.7.9 contains a fix for a pymongo incompatibility.
# (Same fix is present in 2.8.2 on the 2.8.x release line.)
EDXAPP_DDTRACE_PIP_SPEC: 'ddtrace>=2.7.9'
Expand Down
4 changes: 4 additions & 0 deletions playbooks/roles/edxapp/templates/edx/app/edxapp/cms.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ export DD_PROFILING_STACK_V2_ENABLED=true
export DD_PROFILING_TIMELINE_ENABLED=true
{% endif -%}

{% if EDXAPP_DATADOG_INFERRED_SERVICES_ENABLE %}
export DD_TRACE_REMOVE_INTEGRATION_SERVICE_NAMES_ENABLED=true
{% endif -%}

export PORT="{{ edxapp_cms_gunicorn_port }}"
export ADDRESS="{{ edxapp_cms_gunicorn_host }}"
export LANG="{{ EDXAPP_LANG }}"
Expand Down
4 changes: 4 additions & 0 deletions playbooks/roles/edxapp/templates/edx/app/edxapp/lms.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ export DD_PROFILING_STACK_V2_ENABLED=true
export DD_PROFILING_TIMELINE_ENABLED=true
{% endif -%}

{% if EDXAPP_DATADOG_INFERRED_SERVICES_ENABLE %}
export DD_TRACE_REMOVE_INTEGRATION_SERVICE_NAMES_ENABLED=true
{% endif -%}

export PORT="{{ edxapp_lms_gunicorn_port }}"
export ADDRESS="{{ edxapp_lms_gunicorn_host }}"
export LANG="{{ EDXAPP_LANG }}"
Expand Down
4 changes: 4 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 @@ -31,6 +31,10 @@ export DD_DJANGO_INSTRUMENT_MIDDLEWARE=false
export DD_PROFILING_ENABLED=true
{% endif -%}

{% if EDXAPP_DATADOG_INFERRED_SERVICES_ENABLE %}
export DD_TRACE_REMOVE_INTEGRATION_SERVICE_NAMES_ENABLED=true
{% endif -%}

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

exec {{ executable }} $@

0 comments on commit c0949e8

Please sign in to comment.