Document updated on Feb 27, 2024
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 OpenTelemetry integration allows you to send metrics and traces to Datadog using a Collector.
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:
"telemetry/opentelemetry": { "exporters":{} }
| 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:
|
In addition, you can configure how the layers
behave (see all options).
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.6
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:
# Replace with your API key:
- DD_API_KEY=<API-KEY>
- DD_APM_ENABLED=true
# Replace with your site: https://docs.datadoghq.com/getting_started/site/
- 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.
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": [
"gw"
],
"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:
telemetry/opencensus
to telemetry/opentelemetry
.sample_rate
-> Delete this fieldreporting_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 themThe 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.