Use agent OTel metrics for OpenFeature evaluations - #11745
Conversation
🟡 Java Benchmark SLOs — Performance SLO warning (near threshold)
PR vs. master results
Commit: Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion. |
| ``` | ||
|
|
||
| Any OpenTelemetry API 1.x version is compatible. If these dependencies are absent, the provider operates normally without metrics. | ||
| The OpenTelemetry SDK and OTLP exporter are not required on the application classpath. The Datadog |
|
/merge |
|
View all feedbacks in Devflow UI.
The expected merge time in
|
1648e0d
into
master
| OpenTelemetry metrics pipeline: | ||
|
|
||
| ```shell | ||
| DD_METRICS_OTEL_ENABLED=true |
There was a problem hiding this comment.
@sameerank How critical is having this env var?
In our testing we have dd-java-agent-1.64.0 and com.datadoghq:dd-openfeature = 1.64.0 without the DD_METRICS_OTEL_ENABLED and it still worked for emitting server-side evaluation metrics.
Granted our setup has Datadog java tracer for auto instrumentation with otel compatibility for custom spans/metrics. Only otel metrics exporter is enabled and is already manually wired.
-Dotel.traces.exporter=none \ -Dotel.metrics.exporter=otlp \ -Dotel.logs.exporter=none \ -Dotel.exporter.otlp.endpoint=http://${DD_AGENT_HOST}:4317 \ -Dotel.exporter.otlp.protocol=grpc \
What changed
This updates the OpenFeature feature flag evaluation metrics implementation to record through
GlobalOpenTelemetryinstead of constructing its own OpenTelemetry SDK meter provider and OTLP HTTP exporter.It also removes the OpenTelemetry SDK/exporter dependencies from
feature-flagging-api, refreshes the lockfile, and updates the README to document that evaluation metrics use the Datadog Java agent OpenTelemetry metrics pipeline withDD_METRICS_OTEL_ENABLED=true.Why
The previous implementation required
opentelemetry-sdk-metricsandopentelemetry-exporter-otlpon the application classpath and always created an OTLP HTTP exporter. That did not line up with customers already using the Datadog Java agent OTel metrics pipeline for custom metrics, especially when their Agent OTLP receiver is configured for gRPC only.With this change,
feature_flag.evaluationsuses the same configured Java agent OTel metrics pipeline as other custom OTel metrics.Validation
./gradlew :products:feature-flagging:feature-flagging-api:dependencies --write-locks./gradlew :products:feature-flagging:feature-flagging-api:testgit diff --checkgit diff --cached --checkNoted local blockers/noisy checks:
./gradlew :products:feature-flagging:feature-flagging-api:spotlessCheckis currently blocked by:spotlessInternalRegisterDependenciesfailing to provision P2 dependencies../gradlew :dd-java-agent:instrumentation:opentelemetry:opentelemetry-1.47:testfails before tests in unrelated:dd-java-agent:agent-jmxfetch:compileJava; the localotel-bootstrapshadow artifact is missingdatadog.trace.bootstrap.otel.api.common.AttributeKeyandAttributes.Local testing
In ffe-dogfooding
Commented out the unnecessary dependencies and added



opentelemetry-apiSet the protocol to gRPC
And verified that OTLP still working for flags
DD_TRACE_JAVA_PATH=/path/to/dd-trace-java docker-compose -f docker-compose.yml -f local/docker-compose.java.yml up --build:In system-tests
Set local binaries
And ran tests