This page is not yet available in Spanish. We are working on its translation. If you have any questions or feedback about our current translation project, feel free to reach out to us!
The Datadog Agent can automatically assign tags to metrics, traces, and logs emitted by a pod (or an individual container within a pod) based on labels or annotations.
Starting with Agent v6.10+, the Agent can autodiscover tags from Pod annotations. It allows the Agent to associate tags to all data emitted by the entire pods or an individual container within this pod.
As a best practice in containerized environments, Datadog recommends using unified service tagging to help unify tags. Unified service tagging ties Datadog telemetry together through the use of three standard tags: env, service, and version. To learn how to configure your environment with unified tagging, refer to the dedicated unified service tagging documentation.
To apply a <TAG_KEY>:<TAG_VALUE> tag to all data emitted by a given pod and collected by the Agent use the following annotation on your pod:
Starting with Agent v7.17+, the Agent can Autodiscover tags from Docker labels. This process allows the Agent to associate custom tags to all data emitted by a container, without modifying the Agent configuration.
Starting with Agent v7.58+, the Agent can be configured to collect labels for any Kubernetes resource and use them as tags to attach to all metrics, traces, and logs associated with that resource.
This configuration option is more generic and should be preferred over the following options:
Each resource type should be specified in the format resourceType.apiGroup, where resourceType is the plural name of the resource.
If a specific resource is in the empty API group (for example, pods and nodes), it can be specified using resourceType.
To extract a given node label <NODE_LABEL> and transform them as tag keys <NODE_TAG_KEY> within Datadog, add the following configuration to your Operator’s DatadogAgent configuration in datadog-agent.yaml:
For Agent v7.24.0+, use the following environment variable configuration to add all resource labels as tags to your metrics. In this example, the tags’ names for pods are prefixed by <PREFIX>_:
Each resource type should be specified in the format resourceType.apiGroup, where resourceType is the plural name of the resource.
If a specific resource is in the empty API group (for example, pods and nodes), it can be specified using resourceType.
To extract a given node label <NODE_LABEL> and transform them as tag keys <NODE_TAG_KEY> within Datadog, add the following configuration to your Helm datadog-values.yaml file:
For Agent v7.24.0+, use the following environment variable configuration to add all resource labels as tags to your metrics. In this example, the tags’ names for pods are prefixed by <PREFIX>_:
Each resource type should be specified in the format resourceType.apiGroup, where resourceType is the plural name of the resource.
If a specific resource is in the empty API group (for example pods and nodes), it can be specified using resourceType.
To extract a given node label <NODE_LABEL> and transform them as tag keys <NODE_TAG_KEY> within Datadog, add the following environment variable to the Datadog Agent:
For Agent v7.24.0+, use the following environment variable configuration to add all resource labels as tags to your metrics. In this example, the tags’ names for pods are prefixed by <PREFIX>_:
Starting with Agent v7.58+, the Agent can be configured to collect annotations for any Kubernetes resource and use them as tags to attach to all metrics, traces. and logs associated with that resource.
This configuration option is more generic and should be preferred over the following options:
Each resource type should be specified in the format resourceType.apiGroup, where resourceType is the plural name of the resource.
If a specific resource is in the empty API group (for example, pods and nodes), it can be specified using resourceType.
To extract a given node annotation <NODE_ANNOTATION> and transform them as tag keys <NODE_TAG_KEY> within Datadog, add the following configuration to your Operator’s DatadogAgent configuration in datadog-agent.yaml:
For Agent v7.24.0+, use the following environment variable configuration to add all resource annotations as tags to your metrics. In this example, the tags’ names for pods are prefixed by <PREFIX>_:
Each resource type should be specified in the format resourceType.apiGroup, where resourceType is the plural name of the resource.
If a specific resource is in the empty API group (for example pods and nodes), it can be specified using resourceType.
To extract a given node annotation <NODE_ANNOTATION> and transform them as tag keys <NODE_TAG_KEY> within Datadog, add the following configuration to your Helm datadog-values.yaml file:
For Agent v7.24.0+, use the following environment variable configuration to add all resource annotations as tags to your metrics. In this example, the tags’ names for pods are prefixed by <PREFIX>_:
Each resource type should be specified in the format resourceType.apiGroup, where resourceType is the plural name of the resource.
If a specific resource is in the empty api group (for example, pods and nodes), it can be specified using resourceType.
To extract a given node annotation <NODE_ANNOTATION> and transform them as tag keys <NODE_TAG_KEY> within Datadog, add the following environment variable to the Datadog Agent:
For Agent v7.24.0+, use the following environment variable configuration to add all resource annotations as tags to your metrics. In this example, the tags’ names for pods are prefixed by <PREFIX>_:
Starting with Agent v6.0+, the Agent can collect labels for a given node and use them as tags to attach to all metrics, traces, and logs emitted associated with this host in Datadog:
To extract a given node label <NODE_LABEL> and transform it as a tag key <TAG_KEY> within Datadog, add the following configuration to your Operator’s DatadogAgent configuration in datadog-agent.yaml:
For Agent v7.24.0+, use the following environment variable configuration to add all node labels as tags to your metrics. In this example, the tags’ names are prefixed by <PREFIX>_:
To extract a given node label <NODE_LABEL> and transform it as a tag key <TAG_KEY> within Datadog, add the following configuration to your Helm datadog-values.yaml file:
datadog:nodeLabelsAsTags:<NODE_LABEL>:<TAG_KEY>
For example, you could set up:
datadog:nodeLabelsAsTags:kubernetes.io/arch:arch
For Agent v7.24.0+, use the following environment variable configuration to add all node labels as tags to your metrics. In this example, the tags’ names are prefixed by <PREFIX>_:
datadog:nodeLabelsAsTags:"*": <PREFIX>_%%label%%
To extract a given node label <NODE_LABEL> and transform it as a tag key <TAG_KEY> within Datadog, add the following environment variable to the Datadog Agent:
For Agent v7.24.0+, use the following environment variable configuration to add all node labels as tags to your metrics. In this example, the tags’ names are prefixed by <PREFIX>_:
Starting with Agent v6.0+, the Agent can collect labels for a given pod and use them as tags to attach to all metrics, traces, and logs emitted by this pod:
To extract a given pod label <POD_LABEL> and transform it as a tag key <TAG_KEY> within Datadog, add the following configuration to your Operator’s DatadogAgent configuration in datadog-agent.yaml:
For Agent v7.24.0+, use the following environment variable configuration to add all pod labels as tags to your metrics. In this example, the tags’ names are prefixed by <PREFIX>_:
To extract a given pod label <POD_LABEL> and transform it as a tag key <TAG_KEY> within Datadog, add the following configuration to your Helm datadog-values.yaml file:
datadog:podLabelsAsTags:<POD_LABEL>:<TAG_KEY>
For example, you could set up:
datadog:podLabelsAsTags:app:kube_app
For Agent v7.24.0+, use the following environment variable configuration to add all pod labels as tags to your metrics. In this example, the tags’ names are prefixed by <PREFIX>_:
datadog:podLabelsAsTags:"*": <PREFIX>_%%label%%
To extract a given pod label <POD_LABEL> and transform it as a tag key <TAG_KEY> within Datadog, add the following environment variable to the Datadog Agent:
For Agent v6.8.0+, use the following environment variable configuration to add all pod labels as tags to your metrics. In this example, the tags names are prefixed by <PREFIX>_:
Starting with Agent v6.0+, the Agent can collect annotations for a given pod and use them as tags to attach to all metrics, traces, and logs emitted by this pod:
To extract a given pod annotation <POD_ANNOTATION> and transform it as a tag key <TAG_KEY> within Datadog, add the following configuration to your Operator’s DatadogAgent configuration in datadog-agent.yaml
For Agent v7.24.0+, use the following environment variable configuration to add all pod annotations as tags to your metrics. In this example, the tags’ names are prefixed by <PREFIX>_:
To extract a given pod annotation <POD_ANNOTATION> and transform it as a tag key <TAG_KEY> within Datadog, add the following configuration to your Helm datadog-values.yaml file:
For Agent v7.24.0+, use the following environment variable configuration to add all pod annotation as tags to your metrics. In this example, the tags’ names are prefixed by <PREFIX>_:
To extract a given pod annotation <POD_ANNOTATION> and transform it as a tag key <TAG_KEY> within Datadog, add the following environment variable to the Datadog Agent:
For Agent v7.24.0+, use the following environment variable configuration to add all pod annotations as tags to your metrics. In this example, the tags names are prefixed by <PREFIX>_:
Starting with Agent 7.55.0+, the Agent can collect labels for a given namespace and use them as tags to attach to all metrics, traces, and logs emitted by all pods in this namespace:
To extract a given namespace label <NAMESPACE_LABEL> and transform it as a tag key <TAG_KEY> within Datadog, add the following configuration to your Operator’s DatadogAgent configuration in datadog-agent.yaml:
For Agent v7.24.0+, use the following environment variable configuration to add all namespace labels as tags to your metrics. In this example, the tags’ names are prefixed by <PREFIX>_:
To extract a given namespace label <NAMESPACE_LABEL> and transform it as a tag key <TAG_KEY> within Datadog, add the following configuration to your Helm datadog-values.yaml file:
For Agent v7.24.0+, use the following environment variable configuration to add all namespace labels as tags to your metrics. In this example, the tags’ names are prefixed by <PREFIX>_:
To extract a given namespace label <NAMESPACE_LABEL> and transform it as a tag key <TAG_KEY> within Datadog, add the following environment variable to the Datadog Agent:
Use the following environment variable configuration to add all namespace labels as tags to your metrics. In this example, the tag names are prefixed by <PREFIX>_:
Starting with Agent v7.32+, the Agent can collect container environment variables and use them as tags to attach to all metrics, traces, and logs corresponding to the container. Both docker and containerd containers are supported:
To extract a given environment variable <ENV_VAR> and transform it as a tag key <TAG_KEY> within Datadog, add the following configuration to your Operator’s DatadogAgent configuration in datadog-agent.yaml:
To extract a given environment variable <ENV_VAR> and transform it as a tag key <TAG_KEY> within Datadog, add the following configuration to your Helm datadog-values.yaml file:
To extract a given environment variable <ENV_VAR> and transform it as a tag key <TAG_KEY> within Datadog, add the following environment variable to the Datadog Agent:
Starting with Agent v7.33+, the Agent can collect container labels and use them as tags. The agent attaches the tags to all metrics, traces, and logs associated with the container.
The Agent can generate tags from container labels for both docker and containerd containers. In the case of containerd, the minimum supported version is v1.5.6, because previous releases do not propagate labels correctly.
To extract a given container label <CONTAINER_LABEL> and transform it as a tag key <TAG_KEY> within Datadog, add the following configuration to your Operator’s DatadogAgent configuration in datadog-agent.yaml:
To extract a given container label <CONTAINER_LABEL> and transform it as a tag key <TAG_KEY> within Datadog, add the following configuration to your Helm datadog-values.yaml file:
To extract a given container label <CONTAINER_LABEL> and transform it to a tag key <TAG_KEY>, add the following environment variable to the Datadog Agent: