News Automating License Validity Checks with KrakenD

Community Documentation

Recent changes

Datadog Telemetry Integration

Document updated on Feb 27, 2024

Datadog Telemetry Integration

Datadog is a cloud monitoring and security platform for developers, IT operations teams, and businesses.

The OpenTelemetry integration allows you to send metrics and traces to Datadog using a Collector.

Datadog configuration

Datadog uses the standard OTLP exporter, here is a configuration example:

  "version": 3,
  "extra_config": {
        "telemetry/opentelemetry": {
            "service_name": "krakend_service",
            "metric_reporting_period": 1,
            "@comment": "Report 20% of traces",
            "trace_sample_rate": 0.2,
            "exporters": {
                "otlp": [
                        "name": "my_datadog_agent",
                        "host": "ddagent",
                        "port": 8126,
                        "use_http": false

The important part of the configuration is the otlp exporter, which accepts the following fields:

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

The list of OTLP exporters you want to use. Set at least one object to push metrics and traces to an external collector using OTLP. Each item is an object with the following properties:

Disable metrics in this exporter (leaving only traces if any). It won’t report any metrics when the flag is true.
Defaults to false

Disable traces in this exporter (leaving only metrics if any). It won’t report any metrics when the flag is true.
Defaults to false
host  *

The host where you want to push the data. It can be a sidecar or a remote collector.
name  *

A unique name to identify this exporter.
Examples: "local_prometheus" , "remote_grafana"

A custom port to send the data. The port defaults to 4317 for gRPC unless you enable use_http, which defaults to 4318.
Defaults to 4317

Whether this exporter uses HTTP instead of gRPC.

In addition, you can configure how the layers behave (see all options).

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: devopsfaith/krakend:2.6.3
    - /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
    # Replace with your API key:
    - DD_APM_ENABLED=true
    # Replace with your site:

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.

Migrating from OpenCensus

Prior to v2.6, telemetry sent to Datadog used the OpenCensus exporter. Enabling required adding the datadog exporter in the opencensus module, and the configurations looked like this:

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

You can migrate to OpenTelemetry doing the following changes:

  • Rename telemetry/opencensus to telemetry/opentelemetry.
  • sample_rate -> Delete this field
  • reporting_period -> Rename to metric_reporting_period
  • datadog -> Rename to otlp, and add an array surrounding the object, so it becomes "otlp": [{...}]
  • namespace -> Rename to name
  • tag_host, tag_path,tag_method,tag_statuscode -> Delete them


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.