Skip to content

Commit

Permalink
feat!: Switch to method+handler Datadog resource name format (#9)
Browse files Browse the repository at this point in the history
Replaces all instances of `DD_DJANGO_USE_LEGACY_RESOURCE_FORMAT` with
`DD_DJANGO_USE_HANDLER_RESOURCE_FORMAT`. Now resource names will be
prefixed with the HTTP method, like
`GET lms.djangoapps.branding.views.index`.

This is not ideal and loses us some precision in the resource name but
gives us something more readable, writable, and pronounceable. See
edx/edx-arch-experiments#620 for more background.
  • Loading branch information
timmc-edx authored May 20, 2024
1 parent e9b5d83 commit 4a0d959
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export NEW_RELIC_LICENSE_KEY='{{ NEWRELIC_LICENSE_KEY }}'
{% if COMMON_ENABLE_DATADOG and COMMON_ENABLE_DATADOG_APP %}
{% set executable = ecommerce_worker_venv_bin + '/ddtrace-run ' + executable %}
export DD_TAGS="service:edx-{{ ecommerce_worker_service_name }}"
export DD_DJANGO_USE_LEGACY_RESOURCE_FORMAT=true
export DD_DJANGO_USE_HANDLER_RESOURCE_FORMAT=true
# Copied from edx_django_service playbook for consistency; Datadog
# trace debug logging issue doesn't actually affect edxapp for some
# reason.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export NEW_RELIC_LICENSE_KEY="{{ NEWRELIC_LICENSE_KEY }}"
{% if COMMON_ENABLE_DATADOG and COMMON_ENABLE_DATADOG_APP %}
{% set executable = edx_django_service_venv_bin + '/ddtrace-run ' + executable %}
export DD_TAGS="service:{{ edx_django_datadog_service }}"
export DD_DJANGO_USE_LEGACY_RESOURCE_FORMAT=true
export DD_DJANGO_USE_HANDLER_RESOURCE_FORMAT=true
# Workaround for
# https://github.com/edx/edx-arch-experiments/issues/591 (heavy
# streams of trace-debug logs from ddtrace.)
Expand Down
2 changes: 1 addition & 1 deletion playbooks/roles/edxapp/templates/edx/app/edxapp/cms.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export NEW_RELIC_LICENSE_KEY="{{ NEWRELIC_LICENSE_KEY }}"
{% if EDXAPP_DATADOG_ENABLE %}
{% set executable = edxapp_venv_bin + '/ddtrace-run ' + executable %}
export DD_TAGS="service:edx-edxapp-cms"
export DD_DJANGO_USE_LEGACY_RESOURCE_FORMAT=true
export DD_DJANGO_USE_HANDLER_RESOURCE_FORMAT=true
# Copied from edx_django_service playbook for consistency; Datadog
# trace debug logging issue doesn't actually affect edxapp for some
# reason.
Expand Down
2 changes: 1 addition & 1 deletion playbooks/roles/edxapp/templates/edx/app/edxapp/lms.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export NEW_RELIC_LICENSE_KEY="{{ NEWRELIC_LICENSE_KEY }}"
{% if EDXAPP_DATADOG_ENABLE %}
{% set executable = edxapp_venv_bin + '/ddtrace-run ' + executable %}
export DD_TAGS="service:edx-edxapp-lms"
export DD_DJANGO_USE_LEGACY_RESOURCE_FORMAT=true
export DD_DJANGO_USE_HANDLER_RESOURCE_FORMAT=true
# Copied from edx_django_service playbook for consistency; Datadog
# trace debug logging issue doesn't actually affect edxapp for some
# reason.
Expand Down
2 changes: 1 addition & 1 deletion playbooks/roles/forum/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ forum_base_env: &forum_base_env
LISTEN_HOST: "{{ FORUM_LISTEN_HOST }}"
LISTEN_PORT: "{{ FORUM_LISTEN_PORT }}"
DD_TAGS: "{{ FORUM_DD_TAGS }}"
DD_DJANGO_USE_LEGACY_RESOURCE_FORMAT: "true"
DD_DJANGO_USE_HANDLER_RESOURCE_FORMAT: "true"
DD_TRACE_LOG_STREAM_HANDLER: "false"

forum_env:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export NEW_RELIC_LICENSE_KEY="{{ NEWRELIC_LICENSE_KEY }}"
{% if COMMON_ENABLE_DATADOG and COMMON_ENABLE_DATADOG_APP %}
{% set executable = insights_venv_bin + '/ddtrace-run ' + executable %}
export DD_TAGS="service:edx-{{ insights_service_name }}"
export DD_DJANGO_USE_LEGACY_RESOURCE_FORMAT=true
export DD_DJANGO_USE_HANDLER_RESOURCE_FORMAT=true
# Copied from edx_django_service playbook for consistency; Datadog
# trace debug logging issue doesn't actually affect edxapp for some
# reason.
Expand Down
2 changes: 1 addition & 1 deletion playbooks/roles/xqueue/templates/xqueue.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ directory={{ xqueue_code_dir }}

# Copied DD_TRACE_LOG_STREAM_HANDLER config from edx_django_service. This is required
# to disable Datadog trace debug logging.
environment={% if COMMON_ENABLE_NEWRELIC_APP %}NEW_RELIC_APP_NAME={{ XQUEUE_NEWRELIC_APPNAME }},NEW_RELIC_LICENSE_KEY={{ NEWRELIC_LICENSE_KEY }},{% endif -%}{% if COMMON_ENABLE_DATADOG and COMMON_ENABLE_DATADOG_APP %}DD_DJANGO_USE_LEGACY_RESOURCE_FORMAT=true,DD_TAGS=service:{{ XQUEUE_DATADOG_APPNAME }},DD_TRACE_LOG_STREAM_HANDLER=false,{% endif -%}PID=/var/tmp/xqueue.pid,PORT={{ xqueue_gunicorn_port }},ADDRESS={{ xqueue_gunicorn_host }},LANG={{ XQUEUE_LANG }},DJANGO_SETTINGS_MODULE=xqueue.{{ XQUEUE_SETTINGS }},XQUEUE_CFG={{ COMMON_CFG_DIR }}/xqueue.yml
environment={% if COMMON_ENABLE_NEWRELIC_APP %}NEW_RELIC_APP_NAME={{ XQUEUE_NEWRELIC_APPNAME }},NEW_RELIC_LICENSE_KEY={{ NEWRELIC_LICENSE_KEY }},{% endif -%}{% if COMMON_ENABLE_DATADOG and COMMON_ENABLE_DATADOG_APP %}DD_DJANGO_USE_HANDLER_RESOURCE_FORMAT=true,DD_TAGS=service:{{ XQUEUE_DATADOG_APPNAME }},DD_TRACE_LOG_STREAM_HANDLER=false,{% endif -%}PID=/var/tmp/xqueue.pid,PORT={{ xqueue_gunicorn_port }},ADDRESS={{ xqueue_gunicorn_host }},LANG={{ XQUEUE_LANG }},DJANGO_SETTINGS_MODULE=xqueue.{{ XQUEUE_SETTINGS }},XQUEUE_CFG={{ COMMON_CFG_DIR }}/xqueue.yml

stdout_logfile={{ supervisor_log_dir }}/%(program_name)s-stdout.log
stderr_logfile={{ supervisor_log_dir }}/%(program_name)s-stderr.log
Expand Down
2 changes: 1 addition & 1 deletion playbooks/roles/xqueue/templates/xqueue_consumer.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ directory={{ xqueue_code_dir }}

# Copied DD_TRACE_LOG_STREAM_HANDLER config from edx_django_service. This is required
# to disable Datadog trace debug logging.
environment={% if COMMON_ENABLE_NEWRELIC_APP %}NEW_RELIC_STARTUP_TIMEOUT=10,NEW_RELIC_APP_NAME={{ XQUEUE_CONSUMER_NEWRELIC_APPNAME }},NEW_RELIC_LICENSE_KEY={{ NEWRELIC_LICENSE_KEY }},{% endif -%}{% if COMMON_ENABLE_DATADOG and COMMON_ENABLE_DATADOG_APP %}DD_DJANGO_USE_LEGACY_RESOURCE_FORMAT=true,DD_TAGS=service:{{ XQUEUE_CONSUMER_DATADOG_APPNAME }},DD_TRACE_LOG_STREAM_HANDLER=false,{% endif -%}LANG={{ XQUEUE_LANG }},XQUEUE_CFG={{ COMMON_CFG_DIR }}/xqueue.yml
environment={% if COMMON_ENABLE_NEWRELIC_APP %}NEW_RELIC_STARTUP_TIMEOUT=10,NEW_RELIC_APP_NAME={{ XQUEUE_CONSUMER_NEWRELIC_APPNAME }},NEW_RELIC_LICENSE_KEY={{ NEWRELIC_LICENSE_KEY }},{% endif -%}{% if COMMON_ENABLE_DATADOG and COMMON_ENABLE_DATADOG_APP %}DD_DJANGO_USE_HANDLER_RESOURCE_FORMAT=true,DD_TAGS=service:{{ XQUEUE_CONSUMER_DATADOG_APPNAME }},DD_TRACE_LOG_STREAM_HANDLER=false,{% endif -%}LANG={{ XQUEUE_LANG }},XQUEUE_CFG={{ COMMON_CFG_DIR }}/xqueue.yml

stdout_logfile={{ supervisor_log_dir }}/%(program_name)s-stdout.log
stderr_logfile={{ supervisor_log_dir }}/%(program_name)s-stderr.log
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ stdout_logfile={{ supervisor_log_dir }}/%(program_name)s-stdout.log
stderr_logfile={{ supervisor_log_dir }}/%(program_name)s-stderr.log
# Copied DD_TRACE_LOG_STREAM_HANDLER config from edx_django_service. This is required
# to disable Datadog trace debug logging.
environment={% if COMMON_ENABLE_NEWRELIC_APP %}NEW_RELIC_APP_NAME={{ XQWATCHER_NEWRELIC_APPNAME }},NEW_RELIC_LICENSE_KEY={{ NEWRELIC_LICENSE_KEY }},{% endif -%}{% if COMMON_ENABLE_DATADOG and COMMON_ENABLE_DATADOG_APP %}DD_DJANGO_USE_LEGACY_RESOURCE_FORMAT=true,DD_TAGS=service:{{ XQWATCHER_DATADOG_APPNAME }},DD_TRACE_LOG_STREAM_HANDLER=false,{% endif -%}
environment={% if COMMON_ENABLE_NEWRELIC_APP %}NEW_RELIC_APP_NAME={{ XQWATCHER_NEWRELIC_APPNAME }},NEW_RELIC_LICENSE_KEY={{ NEWRELIC_LICENSE_KEY }},{% endif -%}{% if COMMON_ENABLE_DATADOG and COMMON_ENABLE_DATADOG_APP %}DD_DJANGO_USE_HANDLER_RESOURCE_FORMAT=true,DD_TAGS=service:{{ XQWATCHER_DATADOG_APPNAME }},DD_TRACE_LOG_STREAM_HANDLER=false,{% endif -%}
killasgroup=true
stopasgroup=true

0 comments on commit 4a0d959

Please sign in to comment.