Skip to content

Commit

Permalink
temp: Datadog dependencies and testing wrappers
Browse files Browse the repository at this point in the history
Requires:

- `pip install ddtrace`
  • Loading branch information
timmc-edx committed Sep 11, 2024
1 parent 082350e commit d9c4eb2
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lms/envs/devstack.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,12 @@ def should_show_debug_toolbar(request): # lint-amnesty, pylint: disable=missing
'http://localhost:1996', # frontend-app-learner-dashboard
]

# Using patched edx-django-utils
OPENEDX_TELEMETRY = [
'edx_django_utils.monitoring.NewRelicBackend',
'edx_django_utils.monitoring.OpenTelemetryBackend',
'edx_django_utils.monitoring.DatadogBackend',
]

################# New settings must go ABOVE this line #################
########################################################################
Expand Down
3 changes: 3 additions & 0 deletions server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

python /edx/app/edxapp/edx-platform/manage.py lms runserver 0.0.0.0:18000 --settings devstack_docker
19 changes: 19 additions & 0 deletions wrap-datadog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

# https://github.com/edx/edx-arch-experiments/issues/580
#export DD_TRACE_PYMONGO_ENABLED=false

# # Enable Datadog's OpenTelemetry exporter
# export DD_TRACE_OTEL_ENABLED=true

# # Not sure what this does, but if we don't include it we get a startup failure when exporting via OTel:
# # TypeError: Couldn't build proto file into descriptor pool: duplicate file name opentelemetry/proto/common/v1/common.proto
# export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION="python"

#export DD_TRACE_DEBUG=true
#export DD_TRACE_DEBUG_ENABLE=false
#export DD_TRACE_LOG_FILE_LEVEL=ERROR
#export DD_TRACE_LOG_STREAM_HANDLER=no_thank_you
#export DD_TRACE_LOG_FILE=/var/log/dd.log

ddtrace-run "$@"
4 changes: 4 additions & 0 deletions wrap-new-relic.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

export NEW_RELIC_CONFIG_FILE=newrelic.ini
newrelic-admin run-program "$@"
18 changes: 18 additions & 0 deletions wrap-otel.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/bash

if [[ -z "$DJANGO_SETTINGS_MODULE" ]]; then
echo >&2 "You need to set DJANGO_SETTINGS_MODULE when running otel wrapper."
exit 1
fi

export OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED=true
export OTEL_SERVICE_NAME=tmccormack-local-dev
export OTEL_METRICS_EXPORTER=otlp
export OTEL_TRACES_EXPORTER=otlp
export OTEL_LOGS_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_PROTOCOL=grpc
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4317

opentelemetry-instrument "$@"

# opentelemetry-instrument --traces_exporter console --metrics_exporter console --logs_exporter console --service_name tmccormack-local-dev

0 comments on commit d9c4eb2

Please sign in to comment.