Document updated on Oct 24, 2022
Exporting traces to Datadog
Datadog is a cloud monitoring and security platform for developers, IT operations teams, and businesses.
Datadog configuration
The Opencensus exporter allows you to export data to Datadog. Enabling it only requires you to add 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:
Fields of "telemetry/opencensus"
enabled_layers
- Lets you specify what data you want to export. All layers are enabled by default unless you declare this section.
backend
boolean- Reports the activity between KrakenD and your servicesDefaults to
false
pipe
boolean- Reports the activity at the beginning of the proxy layer. It gives a more detailed view of the internals of the pipe between end-users and KrakenD, having into account merging of different backends.Defaults to
false
router
boolean- Reports the activity between end-users and KrakenDDefaults to
false
reporting_period
integer- 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
sample_rate
integer- 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:
Fields of "telemetry/opencensus": { "exporters":{} }
datadog
object- Datadog is a monitoring and security platform for developers, IT operations teams and business in the cloud.
disable_count_per_buckets
boolean- Specifies whether to emit count_per_bucket metrics.Defaults to
false
global_tags
object- A set of tags (key/value) that will automatically be applied to all exported spans.Example:
{"env":"prod"}
namespace
string- The namespace to which metric keys are appended.
service
string- Service specifies the service name used for tracingExample:
"gateway"
stats_address
string- Specifies the host[:port] address for DogStatsD. To enable ingestion using Unix Domain Socket (UDS) mount your UDS path and reference it in the stats_address using a path like
unix:///var/run/datadog/dsd.socket
.Example:"localhost:8125"
Defaults to"localhost:8125"
tags
array- Specifies a set of global tags to attach to each metric.
trace_address
string- Specifies the host[:port] address of the Datadog Trace Agent.Defaults to
"localhost:8126"
B3 propagation
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.