News KrakenD CE v2.7 released with better rate-limiting and security options

Enterprise Documentation

Recent changes

You are viewing a previous version of KrakenD Enterprise Edition (v2.5) , go to the latest version

Datadog Telemetry Integration

Document updated on Feb 28, 2023

Datadog Telemetry Integration

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 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": [
              "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"
* required fields

Lets you specify what data you want to export. All layers are enabled by default unless you declare this section.

Reports the activity between KrakenD and your services
Defaults to false

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

Reports the activity between end-users and KrakenD
Defaults to false

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:

Fields of "telemetry/opencensus": { "exporters":{} }
* required fields

Datadog is a monitoring and security platform for developers, IT operations teams and business in the cloud.
disable_count_per_buckets  *

Specifies whether to emit count_per_bucket metrics.
Defaults to false
global_tags  *

A set of tags (key/value) that will automatically be applied to all exported spans.
Example: {"env":"prod"}
namespace  *

The namespace to which metric keys are appended.
service  *

Service specifies the service name used for tracing
Example: "gateway"
stats_address  *

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  *

Specifies a set of global tags to attach to each metric.
trace_address  *

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.

Datadog agent

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:

  image: krakend/krakend-ee:2.5
    - /var/run/docker.sock:/var/run/docker.sock:ro
    - /proc/:/host/proc/:ro
    - /sys/fs/cgroup/:/host/sys/fs/cgroup:ro
    - 8126:8126/tcp
    - 8125:8125/udp
    - DD_APM_ENABLED=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.


Unresolved issues?

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.