Browse Source

automate enabling trace and logs

master
Brett Langdon 7 years ago
parent
commit
d78e03d087
No known key found for this signature in database GPG Key ID: E6600FB894DB3D19
3 changed files with 10 additions and 57 deletions
  1. +2
    -1
      dash-apm-python/index.json
  2. +5
    -56
      dash-apm-python/step_5.md
  3. +3
    -0
      dash-apm-python/step_5_background.sh

+ 2
- 1
dash-apm-python/index.json View File

@ -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",


+ 5
- 56
dash-apm-python/step_5.md View File

@ -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:


+ 3
- 0
dash-apm-python/step_5_background.sh View File

@ -0,0 +1,3 @@
#!/usr/bin/env bash
echo "DD_LOGS_INTEGRATION=true" >> /tracing-workshop/.env

Loading…
Cancel
Save