diff --git a/playbooks/roles/xqueue/defaults/main.yml b/playbooks/roles/xqueue/defaults/main.yml index 510d69f28f8..aa51e3f644f 100644 --- a/playbooks/roles/xqueue/defaults/main.yml +++ b/playbooks/roles/xqueue/defaults/main.yml @@ -61,6 +61,7 @@ XQUEUE_CONSUMER_NEWRELIC_APPNAME: "{{ COMMON_ENVIRONMENT }}-{{ COMMON_DEPLOYMENT XQUEUE_CONSUMER_DATADOG_APPNAME: "edx-xqueue_consumer" XQUEUE_DATADOG_APPNAME: "edx-{{ xqueue_service_name }}" +XQUEUE_DATADOG_ENABLE: "{{COMMON_ENABLE_DATADOG and COMMON_ENABLE_DATADOG_APP}}" # Set the number of gunicorn front end workers explicitely for xqueue XQUEUE_WORKERS: !!null diff --git a/playbooks/roles/xqueue/tasks/main.yml b/playbooks/roles/xqueue/tasks/main.yml index 8fc4676a1eb..2f06588f936 100644 --- a/playbooks/roles/xqueue/tasks/main.yml +++ b/playbooks/roles/xqueue/tasks/main.yml @@ -75,7 +75,7 @@ - install:app-requirements - name: "Install Datadog APM requirements" - when: COMMON_ENABLE_DATADOG and COMMON_ENABLE_DATADOG_APP + when: XQUEUE_DATADOG_ENABLE pip: name: - ddtrace diff --git a/playbooks/roles/xqueue/templates/xqueue.conf.j2 b/playbooks/roles/xqueue/templates/xqueue.conf.j2 index 6ccf03114d3..0e26cff84ad 100644 --- a/playbooks/roles/xqueue/templates/xqueue.conf.j2 +++ b/playbooks/roles/xqueue/templates/xqueue.conf.j2 @@ -6,7 +6,7 @@ {% set executable = xqueue_venv_bin + '/gunicorn' %} {% endif %} -{% if COMMON_ENABLE_DATADOG and COMMON_ENABLE_DATADOG_APP %} +{% if XQUEUE_DATADOG_ENABLE %} {% set executable = xqueue_venv_bin + '/ddtrace-run ' + executable %} {% endif -%} @@ -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_HANDLER_RESOURCE_FORMAT=true,DD_TAGS="service:{{ XQUEUE_DATADOG_APPNAME }} version:{{ app_version }}",DD_TRACE_LOG_STREAM_HANDLER=false,DD_PROFILING_ENABLED=true,DD_DATA_STREAMS_ENABLED=true,{% 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 XQUEUE_DATADOG_ENABLE %}DD_DJANGO_USE_HANDLER_RESOURCE_FORMAT=true,DD_TAGS="service:{{ XQUEUE_DATADOG_APPNAME }} version:{{ app_version }}",DD_TRACE_LOG_STREAM_HANDLER=false,DD_PROFILING_ENABLED=true,DD_DATA_STREAMS_ENABLED=true,{% 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 diff --git a/playbooks/roles/xqueue/templates/xqueue_consumer.conf.j2 b/playbooks/roles/xqueue/templates/xqueue_consumer.conf.j2 index c9e2db57bbd..46e661877f8 100644 --- a/playbooks/roles/xqueue/templates/xqueue_consumer.conf.j2 +++ b/playbooks/roles/xqueue/templates/xqueue_consumer.conf.j2 @@ -6,7 +6,7 @@ {% set executable = xqueue_venv_bin + '/django-admin run_consumer' %} {% endif %} -{% if COMMON_ENABLE_DATADOG and COMMON_ENABLE_DATADOG_APP %} +{% if XQUEUE_DATADOG_ENABLE %} {% set executable = xqueue_venv_bin + '/ddtrace-run ' + executable %} {% endif -%} @@ -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_HANDLER_RESOURCE_FORMAT=true,DD_TAGS="service:{{ XQUEUE_CONSUMER_DATADOG_APPNAME }} version:{{ app_version }}",DD_TRACE_LOG_STREAM_HANDLER=false,DD_PROFILING_ENABLED=true,DD_DATA_STREAMS_ENABLED=true,{% 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 XQUEUE_DATADOG_ENABLE %}DD_DJANGO_USE_HANDLER_RESOURCE_FORMAT=true,DD_TAGS="service:{{ XQUEUE_CONSUMER_DATADOG_APPNAME }} version:{{ app_version }}",DD_TRACE_LOG_STREAM_HANDLER=false,DD_PROFILING_ENABLED=true,DD_DATA_STREAMS_ENABLED=true,{% 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 diff --git a/playbooks/roles/xqwatcher/defaults/main.yml b/playbooks/roles/xqwatcher/defaults/main.yml index 9797e0c3989..d32a43fa0ea 100644 --- a/playbooks/roles/xqwatcher/defaults/main.yml +++ b/playbooks/roles/xqwatcher/defaults/main.yml @@ -76,6 +76,8 @@ XQWATCHER_NEWRELIC_APPNAME: "{{ COMMON_DEPLOYMENT }}-{{ COMMON_ENVIRONMENT }}-xq XQWATCHER_PIP_EXTRA_ARGS: "-i {{ COMMON_PYPI_MIRROR_URL }}" XQWATCHER_DATADOG_APPNAME: "edx-{{ xqwatcher_service_name }}" +XQWATCHER_DATADOG_ENABLED: "{{COMMON_ENABLE_DATADOG and COMMON_ENABLE_DATADOG_APP}}" + # # # vars are namespace with the module name. diff --git a/playbooks/roles/xqwatcher/tasks/deploy_watcher.yml b/playbooks/roles/xqwatcher/tasks/deploy_watcher.yml index e9a13e29113..af30337a702 100644 --- a/playbooks/roles/xqwatcher/tasks/deploy_watcher.yml +++ b/playbooks/roles/xqwatcher/tasks/deploy_watcher.yml @@ -15,7 +15,7 @@ - install:app-requirements - name: "Install Datadog APM requirements" - when: COMMON_ENABLE_DATADOG and COMMON_ENABLE_DATADOG_APP + when: XQWATCHER_DATADOG_ENABLED pip: name: - ddtrace diff --git a/playbooks/roles/xqwatcher/templates/edx/app/supervisor/conf.d/xqwatcher.conf.j2 b/playbooks/roles/xqwatcher/templates/edx/app/supervisor/conf.d/xqwatcher.conf.j2 index 3429d9ce643..f1682f7f1a7 100644 --- a/playbooks/roles/xqwatcher/templates/edx/app/supervisor/conf.d/xqwatcher.conf.j2 +++ b/playbooks/roles/xqwatcher/templates/edx/app/supervisor/conf.d/xqwatcher.conf.j2 @@ -8,7 +8,7 @@ {% else %} {% set executable = xqwatcher_venv_dir + '/bin/python' %} {% endif %} -{% if COMMON_ENABLE_DATADOG and COMMON_ENABLE_DATADOG_APP %} +{% if XQWATCHER_DATADOG_ENABLED %} {% set executable = xqwatcher_venv_dir + '/bin/ddtrace-run ' + executable %} {% endif -%} @@ -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_HANDLER_RESOURCE_FORMAT=true,DD_TAGS="service:{{ XQWATCHER_DATADOG_APPNAME }} version:{{ app_version }}",DD_TRACE_LOG_STREAM_HANDLER=false,DD_PROFILING_ENABLED=true,DD_DATA_STREAMS_ENABLED=true,{% endif -%} +environment={% if COMMON_ENABLE_NEWRELIC_APP %}NEW_RELIC_APP_NAME={{ XQWATCHER_NEWRELIC_APPNAME }},NEW_RELIC_LICENSE_KEY={{ NEWRELIC_LICENSE_KEY }},{% endif -%}{% if XQWATCHER_DATADOG_ENABLED %}DD_DJANGO_USE_HANDLER_RESOURCE_FORMAT=true,DD_TAGS="service:{{ XQWATCHER_DATADOG_APPNAME }} version:{{ app_version }}",DD_TRACE_LOG_STREAM_HANDLER=false,DD_PROFILING_ENABLED=true,DD_DATA_STREAMS_ENABLED=true,{% endif -%} killasgroup=true stopasgroup=true