An environment is a first class dimension that you use to scope an entire Datadog APM application. Some display settings can be shared across environments, but all the measurable data (traces/metrics/statistics) can not be re-aggregated across multiple environments. Use cases include:
Environments are tags, therefore they must follow the following 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.
[trace.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 “GlobalTags” field in the “opentracing.Configuration” structure.
Via env var:
Datadog.tracer.set_tags(‘env’ => ‘prod’)
from ddtrace import tracer tracer.set_tags('env', 'prod')