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

datadog.yaml (global) or conf.d/<check>/conf.yaml (per source)

Drop high-cardinality labels

exclude_labels in conf.d/openmetrics.d/conf.yaml

Rename metrics

metrics mapping in conf.d/openmetrics.d/conf.yaml or dogstatsd_mapper_profiles in datadog.yaml

Drop metrics by name or pattern

exclude_metrics in conf.d/openmetrics.d/conf.yaml

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 metrics
tags:
  - env:production
  - team:platform
  - region:us-east-1
yaml

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 source
instances:
  - openmetrics_endpoint: http://my-app:8080/metrics
    namespace: my_app
    metrics:
      - ".*"
    tags:
      - env:production
      - team:platform
yaml

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 labels
instances:
  - openmetrics_endpoint: http://my-app:8080/metrics
    namespace: my_app
    metrics:
      - ".*"
    exclude_labels:
      - request_id
      - user_id
      - trace_id
yaml

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 rest
instances:
  - 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)
yaml
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 metrics
instances:
  - 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)
yaml
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 metrics
dogstatsd_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
yaml

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 name
instances:
  - openmetrics_endpoint: http://my-app:8080/metrics
    namespace: my_app
    metrics:
      - ".*"
    exclude_metrics:
      - go_gc_duration_seconds
      - process_open_fds
      - process_max_fds
yaml

To drop all metrics whose names match a regex pattern:

conf.d/openmetrics.d/conf.yaml — drop metrics matching a pattern
instances:
  - openmetrics_endpoint: http://my-app:8080/metrics
    namespace: my_app
    metrics:
      - ".*"
    exclude_metrics:
      - "go_.*"                   (1)
      - "process_runtime_.*"
yaml
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 pattern
instances:
  - openmetrics_endpoint: http://my-app:8080/metrics
    namespace: my_app
    metrics:
      - "http_.*"    (1)
yaml
1 Only metrics whose names start with http_ are collected. All other metrics exposed by the endpoint are ignored.