Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Remove Newrelic from Django IDA's #135

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions playbooks/roles/analytics_api/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ analytics_api_code_dir: "{{ analytics_api_home }}/{{ analytics_api_service_name
analytics_api_wsgi_name: "analyticsdataserver"
analytics_api_hostname: "analytics-api"

analytics_api_newrelic_appname: 'analytics-api'

#
# OS packages
#
Expand Down Expand Up @@ -182,8 +180,6 @@ analytics_api_service_config_overrides:
ANALYTICS_API_USERS:
"dummy-api-user": "changeme"

ANALYTICS_API_ENABLE_NEWRELIC_DISTRIBUTED_TRACING: false

# Remote config
ANALYTICS_API_HERMES_ENABLED: "{{ COMMON_HERMES_ENABLED }}"

Expand Down
2 changes: 0 additions & 2 deletions playbooks/roles/analytics_api/meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,11 @@ dependencies:
edx_django_service_secret_key: '{{ ANALYTICS_API_SECRET_KEY }}'
edx_django_service_wsgi_name: '{{ analytics_api_wsgi_name }}'
edx_django_service_hostname: '~^((stage|prod)-)?{{ analytics_api_hostname }}.*'
edx_django_service_newrelic_appname: '{{ COMMON_ENVIRONMENT }}-{{ COMMON_DEPLOYMENT }}-{{ analytics_api_newrelic_appname }}'
edx_django_service_automated_users: '{{ ANALYTICS_API_AUTOMATED_USERS }}'
edx_django_service_cors_whitelist: '{{ ANALYTICS_API_CORS_ORIGIN_WHITELIST }}'
edx_django_service_allow_cors_headers: '{{ ANALYTICS_API_ALLOW_CORS_HEADERS }}'
edx_django_service_allow_cors_credentials: '{{ ANALYTICS_API_ALLOW_CORS_CREDENTIALS }}'
edx_django_service_basic_auth_exempted_paths_extra: '{{ ANALYTICS_API_BASIC_AUTH_EXEMPTED_PATHS }}'
edx_django_service_enable_newrelic_distributed_tracing: '{{ ANALYTICS_API_ENABLE_NEWRELIC_DISTRIBUTED_TRACING }}'
edx_django_service_decrypt_config_enabled: '{{ ANALYTICS_API_DECRYPT_CONFIG_ENABLED }}'
edx_django_service_copy_config_enabled: '{{ ANALYTICS_API_COPY_CONFIG_ENABLED }}'
edx_django_datadog_service: '{{ analytics_api_datadog_service_name }}'
Expand Down
6 changes: 0 additions & 6 deletions playbooks/roles/ecomworker/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@ ECOMMERCE_WORKER_REPOS:
DESTINATION: '{{ ecommerce_worker_code_dir }}'
SSH_KEY: '{{ ECOMMERCE_WORKER_GIT_IDENTITY }}'

# Requires that New Relic be enabled via COMMON_ENABLE_NEWRELIC, and that
# a key be provided via NEWRELIC_LICENSE_KEY.
ECOMMERCE_WORKER_NEWRELIC_APPNAME: '{{ COMMON_ENVIRONMENT }}-{{ COMMON_DEPLOYMENT }}-{{ ecommerce_worker_service_name }}'
ECOMMERCE_WORKER_ENABLE_NEWRELIC_APP: '{{ COMMON_ENABLE_NEWRELIC_APP }}'
ECOMMERCE_WORKER_ENABLE_NEWRELIC_DISTRIBUTED_TRACING: false

# Datadog
ECOMMERCE_WORKER_DATADOG_ENABLE: "{{COMMON_ENABLE_DATADOG and COMMON_ENABLE_DATADOG_APP}}"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@

{% set executable = ecommerce_worker_venv_bin + '/celery' %}

{% if ECOMMERCE_WORKER_ENABLE_NEWRELIC_APP %}
{% set executable = ecommerce_worker_venv_bin + '/newrelic-admin run-program ' + ecommerce_worker_venv_bin + '/celery' %}

export NEW_RELIC_DISTRIBUTED_TRACING_ENABLED='{{ ECOMMERCE_WORKER_ENABLE_NEWRELIC_DISTRIBUTED_TRACING }}'
export NEW_RELIC_APP_NAME='{{ ECOMMERCE_WORKER_NEWRELIC_APPNAME }}'
export NEW_RELIC_LICENSE_KEY='{{ NEWRELIC_LICENSE_KEY }}'
{% endif -%}

{% if ECOMMERCE_WORKER_DATADOG_ENABLE %}
{% set executable = ecommerce_worker_venv_bin + '/ddtrace-run ' + executable %}
export DD_TAGS="service:edx-{{ ecommerce_worker_service_name }} version:{{ app_version }}"
Expand Down
3 changes: 0 additions & 3 deletions playbooks/roles/edx_django_service/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,6 @@ edx_django_service_basic_auth_exempted_paths_default:
edx_django_service_basic_auth_exempted_paths_extra: []
edx_django_service_basic_auth_exempted_paths: '{{ edx_django_service_basic_auth_exempted_paths_default + edx_django_service_basic_auth_exempted_paths_extra }}'

edx_django_service_newrelic_appname: '{{ COMMON_ENVIRONMENT }}-{{ COMMON_DEPLOYMENT }}-{{ edx_django_service_name }}'
edx_django_service_enable_newrelic_app: '{{ COMMON_ENABLE_NEWRELIC_APP }}'
edx_django_service_enable_newrelic_distributed_tracing: false
edx_django_datadog_service: 'edx-{{ edx_django_service_name }}'
edx_django_service_datadog_enable: '{{ COMMON_ENABLE_DATADOG and (COMMON_ENABLE_DATADOG_APP or edx_django_service_name in COMMON_ENABLE_DATADOG_APP_SERVICES) }}'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,7 @@

{% set edx_django_service_venv_bin = edx_django_service_venv_dir + "/bin" %}

{% if COMMON_ENABLE_NEWRELIC_APP %}
{% set executable = edx_django_service_venv_bin + '/newrelic-admin run-program ' + edx_django_service_venv_bin + '/celery' %}
{% else %}
{% set executable = edx_django_service_venv_bin + '/celery' %}
{% endif %}

{% if COMMON_ENABLE_NEWRELIC_APP %}
HOSTNAME=$(hostname)
export NEW_RELIC_PROCESS_HOST_DISPLAY_NAME="$HOSTNAME"
if command -v ec2metadata >/dev/null 2>&1; then
INSTANCEID=$(ec2metadata --instance-id);
export NEW_RELIC_PROCESS_HOST_DISPLAY_NAME="$HOSTNAME-$INSTANCEID"
fi
{% endif %}

source {{ edx_django_service_home }}/{{ edx_django_service_name }}_env

Expand Down Expand Up @@ -45,12 +32,7 @@ exec docker run \
--env {{ name }} \
{% endif %}
{%- endfor %}
{% if COMMON_ENABLE_NEWRELIC_APP %}
{{ edx_django_service_docker_image_name }}:latest-newrelic \
newrelic-admin run-program \
{% else %}
{{ edx_django_service_docker_image_name }}:latest \
{% endif %}
celery \
$@
{% else %}
Expand Down
24 changes: 0 additions & 24 deletions playbooks/roles/edx_django_service/templates/edx/app/app/app.sh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,6 @@

{% set executable = edx_django_service_venv_bin + '/gunicorn' %}

{% if edx_django_service_enable_newrelic_app %}
{% set executable = edx_django_service_venv_bin + '/newrelic-admin run-program ' + executable %}

export NEW_RELIC_DISTRIBUTED_TRACING_ENABLED="{{ edx_django_service_enable_newrelic_distributed_tracing }}"
export NEW_RELIC_APP_NAME="{{ edx_django_service_newrelic_appname }}"
HOSTNAME=$(hostname)
export NEW_RELIC_PROCESS_HOST_DISPLAY_NAME="$HOSTNAME"
if command -v ec2metadata >/dev/null 2>&1; then
INSTANCEID=$(ec2metadata --instance-id);
export NEW_RELIC_PROCESS_HOST_DISPLAY_NAME="$HOSTNAME-$INSTANCEID"
fi
export NEW_RELIC_LICENSE_KEY="{{ NEWRELIC_LICENSE_KEY }}"
{% endif -%}

{% if edx_django_service_datadog_enable %}
{% set executable = edx_django_service_venv_bin + '/ddtrace-run ' + executable %}
export DD_TAGS="service:{{ edx_django_datadog_service }} version:{{ app_version }}"
Expand Down Expand Up @@ -56,22 +42,12 @@ exec docker run \
--name {{ edx_django_service_name }} \
--mount type=bind,src={{ edx_django_service_app_config_file }},dst={{ edx_django_service_app_config_file }} \
--publish 127.0.0.1:{{ edx_django_service_gunicorn_port }}:{{ edx_django_service_gunicorn_port }}/tcp \
{% if edx_django_service_enable_newrelic_app %}
--env NEW_RELIC_DISTRIBUTED_TRACING_ENABLED \
--env NEW_RELIC_APP_NAME \
--env NEW_RELIC_PROCESS_HOST_DISPLAY_NAME \
--env NEW_RELIC_LICENSE_KEY="{{ NEWRELIC_LICENSE_KEY }}" \
{% endif -%}
{% for name,value in edx_django_service_environment.items() -%}
{%- if value %}
--env {{ name }} \
{% endif %}
{%- endfor %}
{% if COMMON_ENABLE_NEWRELIC_APP %}
{{ edx_django_service_docker_image_name }}:latest-newrelic
{% else %}
{{ edx_django_service_docker_image_name }}:latest
{% endif %}
{% else %}
exec {{ executable }} -c {{ edx_django_service_home }}/{{ edx_django_service_name }}_gunicorn.py {{ edx_django_service_gunicorn_extra }} {{ edx_django_service_wsgi_name }}.wsgi:application
{% endif %}
2 changes: 0 additions & 2 deletions playbooks/roles/insights/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,6 @@ INSIGHTS_CONFIG:
CDN_DOMAIN: "{{ INSIGHTS_CDN_DOMAIN }}"
CSRF_COOKIE_SECURE: "{{ INSIGHTS_CSRF_COOKIE_SECURE }}"

INSIGHTS_NEWRELIC_APPNAME: "{{ COMMON_ENVIRONMENT }}-{{ COMMON_DEPLOYMENT }}-analytics-api"
INSIGHTS_ENABLE_NEWRELIC_DISTRIBUTED_TRACING: false
INSIGHTS_PIP_EXTRA_ARGS: "-i {{ COMMON_PYPI_MIRROR_URL }}"
INSIGHTS_NGINX_PORT: "18110"
INSIGHTS_NGINX_SSL_PORT: "18113"
Expand Down
5 changes: 0 additions & 5 deletions playbooks/roles/xqueue/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ XQUEUE_MYSQL_PORT: '3306'
XQUEUE_MYSQL_OPTIONS: {}
XQUEUE_MYSQL_CONN_MAX_AGE: 0 # This is Django's default https://docs.djangoproject.com/en/1.11/ref/settings/#conn-max-age

XQUEUE_NEWRELIC_APPNAME: "{{ COMMON_ENVIRONMENT }}-{{ COMMON_DEPLOYMENT }}-xqueue"
XQUEUE_CONSUMER_NEWRELIC_APPNAME: "{{ COMMON_ENVIRONMENT }}-{{ COMMON_DEPLOYMENT }}-xqueue_consumer"

XQUEUE_CONSUMER_DATADOG_APPNAME: "edx-xqueue_consumer"
XQUEUE_DATADOG_APPNAME: "edx-{{ xqueue_service_name }}"

Expand Down Expand Up @@ -97,7 +94,6 @@ XQUEUE_CONFIG:
UPLOAD_BUCKET: "{{ XQUEUE_UPLOAD_BUCKET }}"
UPLOAD_PATH_PREFIX: "{{ XQUEUE_UPLOAD_PATH_PREFIX }}"
DEFAULT_FILE_STORAGE: "{{ XQUEUE_DEFAULT_FILE_STORAGE }}"
NEWRELIC_APPNAME: "{{ XQUEUE_NEWRELIC_APPNAME }}"
SUBMISSION_PROCESSING_DELAY: "{{ XQUEUE_SUBMISSION_PROCESSING_DELAY }}"
CONSUMER_DELAY: "{{ XQUEUE_CONSUMER_DELAY }}"
AWS_ACCESS_KEY_ID: "{{ XQUEUE_AWS_ACCESS_KEY_ID }}"
Expand All @@ -123,7 +119,6 @@ XQUEUE_CONFIG:
ATOMIC_REQUESTS: True
CONN_MAX_AGE: "{{ XQUEUE_MYSQL_CONN_MAX_AGE }}"
OPTIONS: "{{ XQUEUE_MYSQL_OPTIONS }}"
NEWRELIC_LICENSE_KEY: "{{ NEWRELIC_LICENSE_KEY | default('') }}"
CLOUDWATCH_QUEUE_COUNT_METRICS: "{{ XQUEUE_CLOUDWATCH_QUEUE_COUNT_METRICS }}"
SESSION_COOKIE_SECURE: "{{ XQUEUE_SESSION_COOKIE_SECURE }}"
CSRF_COOKIE_SECURE: "{{ XQUEUE_CSRF_COOKIE_SECURE }}"
Expand Down
6 changes: 1 addition & 5 deletions playbooks/roles/xqueue/templates/xqueue.conf.j2
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
[program:xqueue]

{% if COMMON_ENABLE_NEWRELIC_APP %}
{% set executable = xqueue_venv_bin + '/newrelic-admin run-program ' + xqueue_venv_bin + '/gunicorn' %}
{% else %}
{% set executable = xqueue_venv_bin + '/gunicorn' %}
{% endif %}

{% if COMMON_ENABLE_DATADOG and COMMON_ENABLE_DATADOG_APP %}
{% set executable = xqueue_venv_bin + '/ddtrace-run ' + executable %}
Expand All @@ -17,7 +13,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,DD_LOGS_INJECTION=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_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,DD_LOGS_INJECTION=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
Expand Down
7 changes: 1 addition & 6 deletions playbooks/roles/xqueue/templates/xqueue_consumer.conf.j2
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
[program:xqueue_consumer]

{% if COMMON_ENABLE_NEWRELIC_APP %}
{% set executable = xqueue_venv_bin + '/newrelic-admin run-program ' + xqueue_venv_bin + '/django-admin run_consumer' %}
{% else %}
{% set executable = xqueue_venv_bin + '/django-admin run_consumer' %}
{% endif %}

{% if COMMON_ENABLE_DATADOG and COMMON_ENABLE_DATADOG_APP %}
{% set executable = xqueue_venv_bin + '/ddtrace-run ' + executable %}
Expand All @@ -17,11 +13,10 @@ 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,DD_LOGS_INJECTION=true,{% endif -%}LANG={{ XQUEUE_LANG }},XQUEUE_CFG={{ COMMON_CFG_DIR }}/xqueue.yml
environment={% 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,DD_LOGS_INJECTION=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
killasgroup=true
stopasgroup=true
startsecs=0

Loading