![]() |
VOOZH | about |
Environments represent different deployment stages or modes in your software delivery life cycle, such as Development, Staging, and Production. Flag configuration is isolated by environment. A flag can be enabled, disabled, overridden, or given targeting rules in one environment without affecting other environments.
Manage environments from Feature Flags > Settings > Environments:
By default, Datadog creates three environments for your organization:
You can modify these environments or add new ones to match how your team deploys code.
Mark an environment as production to indicate that changes in that environment can affect customers. Production environments support additional governance controls, such as required change approvals.
Each environment is configured with a name and a set of queries. Queries are the env or DD_ENV strings your applications send at runtime.
Having multiple queries per environment lets you keep the env value consistent with the environment you pass to RUM, APM, or StatsD. For example, you might have staging-eu and staging-us as separate env values in your telemetry, but map both to a single Staging environment in Feature Flags. That way, you do not need to duplicate flag configuration across multiple Staging environments when you want to enable a flag across all of Staging.
The env value you use must match a query configured for the Feature Flags environment you want, such as staging-us or production. If you already set env or DD_ENV for RUM, APM, or tracing, use the same value for Feature Flags.
Set env when you initialize the Datadog OpenFeature provider (same value as RUM):
import { DatadogProvider } from '@datadog/openfeature-browser';
import { OpenFeature } from '@openfeature/web-sdk';
const provider = new DatadogProvider({
clientToken: '<CLIENT_TOKEN>',
applicationId: '<APPLICATION_ID>',
site: 'datadoghq.com',
env: 'staging-us', // Must match an environment query in Feature Flags
service: '<SERVICE_NAME>',
version: '1.0.0',
});
await OpenFeature.setProviderAndWait(provider);
Set DD_ENV in your deployment environment (shell, container, or orchestrator), not in application code:
export DD_ENV=staging-us # Must match an environment query in Feature Flags
export DD_SERVICE=<YOUR_SERVICE_NAME>
export DD_EXPERIMENTAL_FLAGGING_PROVIDER_ENABLED=trueThis applies to Python, Go, Java, Node.js, Ruby, and .NET server SDKs. See Server-Side Feature Flags for language-specific setup.
Additional helpful documentation, links, and articles:
| |