diff --git a/dash-apm-python/index.json b/dash-apm-python/index.json index 1b0e423..1395fe6 100644 --- a/dash-apm-python/index.json +++ b/dash-apm-python/index.json @@ -22,7 +22,8 @@ }, { "title": "Enable trace and logs", - "text": "step_5.md" + "text": "step_5.md", + "text": "step_5_background.md" }, { "title": "Introducing errors", diff --git a/dash-apm-python/step_5.md b/dash-apm-python/step_5.md index cdd7999..28872e1 100644 --- a/dash-apm-python/step_5.md +++ b/dash-apm-python/step_5.md @@ -19,65 +19,14 @@ agent: # Enable trace id injection into logs -Add the following environment variable to the `frontend`, `node`, `pumps`, -and `sensors` services in `docker-compose.yml`. +In order to coorelate traces and logs we need our services to inject +trace and span ids into our application logs. -`DD_LOGS_INTEGRATION=true`{{copy}} +We can enable inject by setting the `DD_LOGS_INTEGRATION=true` environment variable. -Our services should look like: +We have taken care of this step for you. -```yaml -frontend: - env_file: ".env" - environment: - - DATADOG_SERVICE_NAME=frontend - - DATADOG_TRACE_AGENT_HOSTNAME=agent - - DD_ANALYTICS_ENABLED=true - - DD_LOGS_INTEGRATION=true -```{{copy}} - -``` yaml -node: - env_file: ".env" - environment: - - DD_SERVICE_NAME=users-api - - DD_TRACE_AGENT_HOSTNAME=agent - - DD_ANALYTICS_ENABLED=true - - DD_LOGS_INTEGRATION=true -```{{copy}} - -``` yaml -pumps: - env_file: ".env" - environment: - - FLASK_APP=pumps.py - - FLASK_DEBUG=1 - - POSTGRES_PASSWORD=postgres - - POSTGRES_USER=postgres - - DATADOG_SERVICE_NAME=pumps-service - - DATADOG_TRACE_AGENT_HOSTNAME=agent - - DD_ANALYTICS_ENABLED=true - - DD_LOGS_INTEGRATION=true -```{{copy}} - -``` yaml -sensors: - env_file: ".env" - environment: - - FLASK_APP=sensors.py - - FLASK_DEBUG=1 - - POSTGRES_PASSWORD=postgres - - POSTGRES_USER=postgres - - DATADOG_SERVICE_NAME=sensors-api - - DATADOG_TRACE_AGENT_HOSTNAME=agent - - DD_ANALYTICS_ENABLED=true - - DD_LOGS_INTEGRATION=true -```{{copy}} - - -Afterwards restart docker services: - -`restart-services`{{execute interrupt}} +To complete the process `restart-services`{{execute interrupt}} Finally, open logs dashboard: diff --git a/dash-apm-python/step_5_background.sh b/dash-apm-python/step_5_background.sh new file mode 100644 index 0000000..2a8d8e9 --- /dev/null +++ b/dash-apm-python/step_5_background.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +echo "DD_LOGS_INTEGRATION=true" >> /tracing-workshop/.env