There are several dimensions that you can configure to scope an entire Datadog APM application. This includes aggregate statistics (such as requests/second, latency, error rate, Apdex score) and visible traces.
An environment is a first-class dimension that is used to scope an entire Datadog APM application. Some display settings are shared across environments, but measurable data (traces/aggregate statistics) cannot be re-aggregated across multiple environments. Use cases include:
Environments are tags which must follow these rules:
Environments in traces and configuration files are normalized:
The default environment for un-tagged data is
env:none. See below to see how to specify custom environments:
There are several ways to specify an environment when reporting data:
Use a host tag with the format
env:XXXX to tag all traces from that Agent accordingly.
Override the default tag used by the trace Agent in the Agent configuration file. This tags all traces coming through the Agent, overriding the host tag value.
apm_config: env: pre-prod
When submitting a single trace, specify an environment by tagging one of its spans with the metadata key
env. This overrides the Agent configuration and the host tags value (if any).
For OpenTracing use the
tracer.WithGlobalTag start option to set the environment globally.
Java: Via sysprop:
Via env var:
Datadog.tracer.set_tags(‘env’ => ‘prod’)
from ddtrace import tracer tracer.set_tags('env', 'prod')
Environments appear near the top of APM pages. Use the dropdown to scope the data displayed on the current page.
A primary tag is a first-class dimension that is used to scope an entire Datadog APM application. Primary tags are used in conjunction with environments to get an even finer view of your application’s behavior. Use cases for primary tags include:
Primary tags must follow a different set of rules from those of conventional tags:
APM primary tags must be set up in two ways: in the trace Agent and in the Datadog UI.
Override the default tag used by the trace Agent in the Agent configuration file. This tags all traces coming through the Agent, overriding the host tag value. An APM primary tag is configured like any regular host tag. Specify it as:
tags: - key:value
Visit the APM Settings page to define, change, or remove primary tags. Note:
If you change a previously set primary tag, please be aware of the following:
Primary tags appear near the top of APM pages, next to environments. Use these selectors to slice the data displayed on the current page. To view all data independent of a primary tag, choose
tag-name:* from the dropdown (as in the image below).