Document updated on Feb 28, 2023
Since | v1.2 |
---|---|
Namespace | telemetry/opencensus |
Log prefix | [SERVICE: Opencensus] |
Scope | service |
Source | krakend/krakend-opencensus |
Datadog is a cloud monitoring and security platform for developers, IT operations teams, and businesses.
The Opencensus exporter allows you to export data to Datadog. Enabling it only requires adding the datadog
exporter in the opencensus module.
The following configuration snippet sends data to your Datadog:
{
"version": 3,
"extra_config": {
"telemetry/opencensus": {
"sample_rate": 100,
"reporting_period": 0,
"exporters": {
"datadog": {
"tags": [
"gw"
],
"global_tags": {
"env": "prod"
},
"disable_count_per_buckets": true,
"trace_address": "localhost:8126",
"stats_address": "localhost:8125",
"namespace": "krakend",
"service": "gateway"
}
}
}
}
}
As with all OpenCensus exporters, you can add optional settings in the telemetry/opencensus
level:
"telemetry/opencensus"
| Lets you specify what data you want to export. All layers are enabled by default unless you declare this section.
| ||||||
| The number of seconds passing between reports. If duration is less than or equal to zero, it enables the default behavior of each exporter. Defaults to 0 | ||||||
| A number between 0 (no requests at all) and 100 (all requests) representing the percentage of sampled requests you want to send to the exporter. Sampling the 100% of the requests is generally discouraged when the relationship between traffic and dedicated resources is sparse. Defaults to 0 |
Then, the exporters
key must contain an datadog
entry with the following properties:
"telemetry/opencensus": { "exporters":{} }
| Datadog is a monitoring and security platform for developers, IT operations teams and business in the cloud.
|
The Opencensus module uses B3-style propagation headers, while the rest of your services might be using Datadog-specific propagation headers. If this difference is actual, krakend traces will show up in Datadog, but they won’t be connected to the frontend and backend traces.
The ddtrace-run
adds an option to support B3 style propagation using the environment variables DD_TRACE_PROPAGATION_STYLE_EXTRACT
and DD_TRACE_PROPAGATION_STYLE_INJECT
. Use these variables to have your traces perfectly aligned.
For more information, see its configuration.
You must set your Datadog API key in the agent. The exporter communicates with the agent and is the agent the one reporting to Datadog.
Here’s an example of how to run the Datadog agent together with KrakenD in a docker-compose file:
krakend:
image: devopsfaith/krakend:2.5
ddagent:
image: gcr.io/datadoghq/agent:latest
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- /proc/:/host/proc/:ro
- /sys/fs/cgroup/:/host/sys/fs/cgroup:ro
ports:
- 8126:8126/tcp
- 8125:8125/udp
environment:
- DD_API_KEY=<API-KEY>
- DD_APM_ENABLED=true
- DD_SITE=<DATADOG-SITE>
- DD_APM_NON_LOCAL_TRAFFIC=true
And the configuration would contain:
{ "datadog":
{
"@comment": "Rest of the necessary fields intentionally omitted",
"trace_address": "ddagent:8126",
"stats_address": "ddagent:8125"
}
}
Notice that we are naming the service ddagent
in Docker compose, and this is what we have added in the address.
The documentation is only a piece of the help you can get! Whether you are looking for Open Source or Enterprise support, see more support channels that can help you.