From a3287d57676ead347161bd96e3a6f5d11fcfe590 Mon Sep 17 00:00:00 2001
From: nadeemshahzad <mshahzad@2u.com>
Date: Fri, 31 Jan 2025 15:20:44 +0500
Subject: [PATCH] chore: Set DD_SERVICE Environment Variable for edxapp

---
 playbooks/roles/edxapp/templates/edx/app/edxapp/cms.sh.j2    | 1 +
 playbooks/roles/edxapp/templates/edx/app/edxapp/lms.sh.j2    | 1 +
 playbooks/roles/edxapp/templates/edx/app/edxapp/worker.sh.j2 | 1 +
 3 files changed, 3 insertions(+)

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 d34bab1cbba..808bf6a7a35 100644
--- a/playbooks/roles/edxapp/templates/edx/app/edxapp/cms.sh.j2
+++ b/playbooks/roles/edxapp/templates/edx/app/edxapp/cms.sh.j2
@@ -13,6 +13,7 @@ export DD_DJANGO_USE_HANDLER_RESOURCE_FORMAT=true
 export DD_GIT_COMMIT_SHA="{{ app_version }}"
 export DD_GIT_REPOSITORY_URL="{{ EDXAPP_REPOSITORY_GIT_URL }}"
 export DD_LOGS_INJECTION=true
+export DD_SERVICE="edx-edxapp-cms"
 # Copied from edx_django_service playbook for consistency; Datadog
 # trace debug logging issue doesn't actually affect edxapp for some
 # reason.
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 424fa82aa0f..e523def51f7 100644
--- a/playbooks/roles/edxapp/templates/edx/app/edxapp/lms.sh.j2
+++ b/playbooks/roles/edxapp/templates/edx/app/edxapp/lms.sh.j2
@@ -13,6 +13,7 @@ export DD_DJANGO_USE_HANDLER_RESOURCE_FORMAT=true
 export DD_GIT_COMMIT_SHA="{{ app_version }}"
 export DD_GIT_REPOSITORY_URL="{{ EDXAPP_REPOSITORY_GIT_URL }}"
 export DD_LOGS_INJECTION=true
+export DD_SERVICE="edx-edxapp-lms"
 # Copied from edx_django_service playbook for consistency; Datadog
 # trace debug logging issue doesn't actually affect edxapp for some
 # reason.
diff --git a/playbooks/roles/edxapp/templates/edx/app/edxapp/worker.sh.j2 b/playbooks/roles/edxapp/templates/edx/app/edxapp/worker.sh.j2
index 818e5278f9b..9d1077dc3b3 100644
--- a/playbooks/roles/edxapp/templates/edx/app/edxapp/worker.sh.j2
+++ b/playbooks/roles/edxapp/templates/edx/app/edxapp/worker.sh.j2
@@ -13,6 +13,7 @@ export DD_DJANGO_USE_LEGACY_RESOURCE_FORMAT=true
 export DD_GIT_COMMIT_SHA="{{ app_version }}"
 export DD_GIT_REPOSITORY_URL="{{ EDXAPP_REPOSITORY_GIT_URL }}"
 export DD_LOGS_INJECTION=true
+export DD_SERVICE="edx-edxapp-${SERVICE_VARIANT}-workers"
 # Copied from edx_django_service playbook for consistency; Datadog
 # trace debug logging issue doesn't actually affect edxapp for some
 # reason.