Datadog Agent Metric Processing
The Datadog Agent applies check-level configuration to reshape metric data before it is forwarded to Kloudfuse.
Configuration is split across two file types: datadog.yaml for global agent settings, and conf.d/<source>.d/conf.yaml for per-check settings.
Overview
Metric processing is configured at the check level inside conf.d/openmetrics.d/conf.yaml for Prometheus and OpenMetrics endpoints, and in datadog.yaml for DogStatsD metrics.
The following operations are available:
| Operation | Configured in |
|---|---|
Add tags to all metrics |
|
Drop high-cardinality labels |
|
Rename metrics |
|
Drop metrics by name or pattern |
|
Add Tags to Metrics
Tags set in datadog.yaml are attached to every metric, log, and event collected by the agent.
Use this to add environment, region, or team labels that apply across your entire infrastructure:
datadog.yaml — add global tags to all metricstags:
- env:production
- team:platform
- region:us-east-1
To add tags only to metrics collected by a specific OpenMetrics endpoint, set them in the check config:
conf.d/openmetrics.d/conf.yaml — add tags to a specific metrics sourceinstances:
- openmetrics_endpoint: http://my-app:8080/metrics
namespace: my_app
metrics:
- ".*"
tags:
- env:production
- team:platform
Drop High-Cardinality Labels
When collecting metrics from a Prometheus or OpenMetrics endpoint, use exclude_labels to remove label keys that create an unbounded number of time series — such as request IDs, user IDs, or raw URLs.
The listed labels are stripped from every metric collected by that check instance:
conf.d/openmetrics.d/conf.yaml — drop high-cardinality labelsinstances:
- openmetrics_endpoint: http://my-app:8080/metrics
namespace: my_app
metrics:
- ".*"
exclude_labels:
- request_id
- user_id
- trace_id
To keep only a specific set of labels and drop all others, combine exclude_labels with static tags:
conf.d/openmetrics.d/conf.yaml — keep only specific labels, drop the restinstances:
- openmetrics_endpoint: http://my-app:8080/metrics
namespace: my_app
metrics:
- ".*"
exclude_labels:
- request_id
- user_id
- pod_id
- container_id
tags:
- env:production (1)
| 1 | Static tags added here are always present on the metrics regardless of what labels the endpoint exposes. |
Rename Metrics
For OpenMetrics endpoints, rename individual metrics by providing a mapping in the metrics list.
Each entry maps the scraped metric name to the desired output name:
conf.d/openmetrics.d/conf.yaml — rename specific metricsinstances:
- openmetrics_endpoint: http://my-app:8080/metrics
namespace: my_app
metrics:
- http_server_duration: http.server.request.duration (1)
- process_cpu_usage: process.cpu.utilization
- ".*" (2)
| 1 | The scraped metric http_server_duration is forwarded to Kloudfuse as my_app.http.server.request.duration (the namespace is prepended automatically). |
| 2 | Collect all remaining metrics under their original names. |
For DogStatsD metrics, use dogstatsd_mapper_profiles in datadog.yaml to rename metrics by matching a pattern:
datadog.yaml — rename DogStatsD metricsdogstatsd_mapper_profiles:
- name: my_app
prefix: "my_app."
mappings:
- match: "my_app.http_server_duration"
name: "my_app.http.server.request.duration"
- match: "my_app.process_cpu_*"
name: "my_app.process.cpu.$1"
match_type: wildcard
Drop Metrics by Name or Pattern
For OpenMetrics endpoints, use exclude_metrics to drop metrics by exact name or regex pattern.
Each entry is a drop condition — any metric whose name matches is not forwarded to Kloudfuse:
conf.d/openmetrics.d/conf.yaml — drop metrics by exact nameinstances:
- openmetrics_endpoint: http://my-app:8080/metrics
namespace: my_app
metrics:
- ".*"
exclude_metrics:
- go_gc_duration_seconds
- process_open_fds
- process_max_fds
To drop all metrics whose names match a regex pattern:
conf.d/openmetrics.d/conf.yaml — drop metrics matching a patterninstances:
- openmetrics_endpoint: http://my-app:8080/metrics
namespace: my_app
metrics:
- ".*"
exclude_metrics:
- "go_.*" (1)
- "process_runtime_.*"
| 1 | Drops all metrics whose names start with go_. Any metric matching any pattern in exclude_metrics is dropped. |
To forward only metrics that match a specific pattern and drop everything else, list only the desired pattern in metrics rather than ".*":
conf.d/openmetrics.d/conf.yaml — collect only metrics matching a patterninstances:
- openmetrics_endpoint: http://my-app:8080/metrics
namespace: my_app
metrics:
- "http_.*" (1)
| 1 | Only metrics whose names start with http_ are collected. All other metrics exposed by the endpoint are ignored. |