This product is not supported for your selected Datadog site. ().
Overview
Flag evaluation metrics let you measure how often each variant of a feature flag is returned by your server-side application. Use these metrics to track flag adoption over time, verify targeting rules are working as expected, and graph flag evaluation data on dashboards.
The feature_flag.evaluations metric is experimental and may change or be removed in a future release.
The feature_flag.evaluations metric is separate from experiment exposure events and Event Platform Proxy (EVP) flag evaluation events. Exposure and EVP event egress use the standard tracer URL on port 8126. This metric uses an OTLP endpoint on port 4317 or 4318.
Prerequisites
Before setting up flag evaluation metrics, confirm the following:
For Agent-backed configurations that use the legacy activation path, DD_EXPERIMENTAL_FLAGGING_PROVIDER_ENABLED=true is set on your application.
Your server-side tracer meets the minimum version for flag evaluation metrics support:
Language
Minimum tracer version
.NET
3.44.0
Go
2.8.0
Java
1.62.0
Node.js
5.99.0
PHP
1.21.1
Python
4.7.0
Ruby
2.32.0
Agentless configuration delivery and this metric use independent paths. An agentless SDK can emit the metric when you configure the required OTLP path through a supported Agent-backed or serverless telemetry setup.
Step 1: Configure an OTLP receiver
Flag evaluation metrics are emitted over OpenTelemetry (OTLP). For Agent-backed deployments, enable the Datadog Agent OTLP receiver, which is off by default. For setup instructions, see OTLP Ingestion by the Datadog Agent. For no-Agent serverless deployments, use the OTLP or custom metrics path supported by your Serverless Monitoring setup.
You only need to enable the protocol your application uses (gRPC on port 4317, or HTTP on port 4318).
If you are running Agent v7.61.0 or later in Docker, set HOST_PROC=/proc on the Agent container to work around a known issue with the OTLP pipeline.
# Enable flag evaluation metricsDD_METRICS_OTEL_ENABLED=true
Java: Add the OpenTelemetry SDK dependencies
The Java provider records feature_flag.evaluations through the OpenTelemetry SDK and exports it over OTLP, so the opentelemetry-sdk-metrics and opentelemetry-exporter-otlp dependencies must be on your application’s classpath. Add them alongside your Java feature flag dependencies. Import the OpenTelemetry BOM so the OpenTelemetry API and SDK stay on the same version:
On the Java tracer, the provider starts its OTLP metrics exporter automatically when the OpenTelemetry SDK is on the classpath. If the dependencies are missing, no metrics are emitted and the tracer logs OpenTelemetry SDK is not on the classpath.
In Spring Boot applications, Spring Boot's OpenTelemetry autoconfiguration also creates an OpenTelemetrySdk bean. If the OpenTelemetry SDK version it resolves does not match the OpenTelemetry API version on the classpath, startup fails with a BeanCreationException for the openTelemetry bean and NoClassDefFoundError: io/opentelemetry/sdk/internal/ScopeConfigurator. Importing the opentelemetry-bom as shown above keeps the API and SDK on the same version and resolves the error.
Ruby: Add the OpenTelemetry metrics gems
For Ruby applications, add the OpenTelemetry metrics SDK and OTLP metrics exporter gems to your application bundle:
Install the gems with bundle install. These gems provide the OpenTelemetry meter provider and OTLP metrics exporter. The Ruby tracer uses them when DD_METRICS_OTEL_ENABLED=true is set. If the gems are missing, the Ruby tracer does not emit feature_flag.evaluations metrics and logs Failed to load OpenTelemetry metrics gems.
Endpoint configuration
DD_TRACE_AGENT_URL and the standard serverless-init listener on port 8126 do not configure the OTLP metric endpoint. Configure the OTLP endpoint separately, as described in the following section. For no-Agent serverless deployments, follow the Serverless Monitoring setup for your platform before configuring this metric.
By default, most tracers send OTLP metrics to the Agent at DD_AGENT_HOST on port 4318 (HTTP). If your application already sets DD_AGENT_HOST to reach the Agent, no endpoint configuration is required.
Set an OTLP endpoint explicitly in any of these cases:
The Agent is not reachable at DD_AGENT_HOST on the default OTLP port (for example, a remote Agent or a non-default port).
You use the Java tracer. Its flag evaluation metrics exporter supports OTLP/HTTP only (gRPC is not supported) on port 4318. The Java tracer does not derive the endpoint from DD_AGENT_HOST and defaults to http://localhost:4318. Set OTEL_EXPORTER_OTLP_ENDPOINT to the Agent’s HTTP endpoint when the Agent is not on localhost.
You use the Python tracer. The Python tracer defaults to gRPC on port 4317, not HTTP. Enable the gRPC OTLP receiver on the Agent, or override the protocol to use HTTP instead:
To set the endpoint, use the standard OpenTelemetry variable:
# Point OTLP data at the Datadog Agent (HTTP, port 4318)OTEL_EXPORTER_OTLP_ENDPOINT=http://<AGENT_HOST>:4318
# Or use gRPC (port 4317). For most tracers, the default protocol is http/protobuf,# so set the protocol explicitly when switching to gRPC:# OTEL_EXPORTER_OTLP_ENDPOINT=http://<AGENT_HOST>:4317# OTEL_EXPORTER_OTLP_PROTOCOL=grpc
Replace <AGENT_HOST> with the hostname or IP address of your Datadog Agent.
Docker Compose example:
docker-compose.yml
services:datadog-agent:environment:- DD_OTLP_CONFIG_RECEIVER_PROTOCOLS_GRPC_ENDPOINT=0.0.0.0:4317- DD_OTLP_CONFIG_RECEIVER_PROTOCOLS_HTTP_ENDPOINT=0.0.0.0:4318- HOST_PROC=/proc # If running Agent v7.61.0+ in Dockerapp-go:environment:- DD_EXPERIMENTAL_FLAGGING_PROVIDER_ENABLED=true- DD_METRICS_OTEL_ENABLED=true- OTEL_EXPORTER_OTLP_ENDPOINT=http://datadog-agent:4318depends_on:datadog-agent:condition:service_healthy
Step 3: Verify metrics are flowing
After deploying, confirm metrics are reaching Datadog: