From 7a3bef8b54d836e6d9067f8f8f68e52f3b11f229 Mon Sep 17 00:00:00 2001 From: Tim McCormack Date: Mon, 13 May 2024 21:55:38 +0000 Subject: [PATCH] feat: Allow per-service Datadog APM enable for edxapp This will allow us to enable Datadog for edxapp independently of other services during the migration. It also pushes the knowledge of the two common switches into the defaults layer so that only one variable needs to be consulted. Similar work for other services would follow. I've also switched to a topic-first rather than an `ENABLE`-first naming convention since it tends to sort and group better. This supports https://github.com/edx/edx-arch-experiments/issues/632 --- playbooks/roles/edxapp/defaults/main.yml | 1 + playbooks/roles/edxapp/tasks/deploy.yml | 2 +- playbooks/roles/edxapp/templates/edx/app/edxapp/cms.sh.j2 | 2 +- playbooks/roles/edxapp/templates/edx/app/edxapp/lms.sh.j2 | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/playbooks/roles/edxapp/defaults/main.yml b/playbooks/roles/edxapp/defaults/main.yml index 3cc1a16a9b6..3221affbb9c 100644 --- a/playbooks/roles/edxapp/defaults/main.yml +++ b/playbooks/roles/edxapp/defaults/main.yml @@ -635,6 +635,7 @@ EDXAPP_NEWRELIC_WORKERS_APPNAME: "{{ COMMON_ENVIRONMENT }}-{{ COMMON_DEPLOYMENT EDXAPP_LMS_ENABLE_NEWRELIC_DISTRIBUTED_TRACING: false EDXAPP_CMS_ENABLE_NEWRELIC_DISTRIBUTED_TRACING: false EDXAPP_WORKERS_ENABLE_NEWRELIC_DISTRIBUTED_TRACING: false +EDXAPP_DATADOG_ENABLE: "{{COMMON_ENABLE_DATADOG and COMMON_ENABLE_DATADOG_APP}}" EDXAPP_ORA2_FILE_PREFIX: '{{ COMMON_ENVIRONMENT }}-{{ COMMON_DEPLOYMENT }}/ora2' EDXAPP_FILE_UPLOAD_STORAGE_BUCKET_NAME: '{{ EDXAPP_AWS_STORAGE_BUCKET_NAME }}' diff --git a/playbooks/roles/edxapp/tasks/deploy.yml b/playbooks/roles/edxapp/tasks/deploy.yml index d27bdab0782..9501801e990 100644 --- a/playbooks/roles/edxapp/tasks/deploy.yml +++ b/playbooks/roles/edxapp/tasks/deploy.yml @@ -217,7 +217,7 @@ - install:app-requirements - name: "Install Datadog APM requirements" - when: COMMON_ENABLE_DATADOG and COMMON_ENABLE_DATADOG_APP + when: EDXAPP_DATADOG_ENABLE pip: name: - ddtrace diff --git a/playbooks/roles/edxapp/templates/edx/app/edxapp/cms.sh.j2 b/playbooks/roles/edxapp/templates/edx/app/edxapp/cms.sh.j2 index 1598a2d8388..03c1da59e8f 100644 --- a/playbooks/roles/edxapp/templates/edx/app/edxapp/cms.sh.j2 +++ b/playbooks/roles/edxapp/templates/edx/app/edxapp/cms.sh.j2 @@ -20,7 +20,7 @@ fi export NEW_RELIC_LICENSE_KEY="{{ NEWRELIC_LICENSE_KEY }}" {% endif -%} -{% if COMMON_ENABLE_DATADOG and COMMON_ENABLE_DATADOG_APP %} +{% 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 diff --git a/playbooks/roles/edxapp/templates/edx/app/edxapp/lms.sh.j2 b/playbooks/roles/edxapp/templates/edx/app/edxapp/lms.sh.j2 index 4ec43ff52ce..f55f9eec12c 100644 --- a/playbooks/roles/edxapp/templates/edx/app/edxapp/lms.sh.j2 +++ b/playbooks/roles/edxapp/templates/edx/app/edxapp/lms.sh.j2 @@ -20,7 +20,7 @@ fi export NEW_RELIC_LICENSE_KEY="{{ NEWRELIC_LICENSE_KEY }}" {% endif -%} -{% if COMMON_ENABLE_DATADOG and COMMON_ENABLE_DATADOG_APP %} +{% 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