Repository navigation
Flush OpenTelemetry metrics by closing the MeterProvider - #12909
PerfectSlayer wants to merge 2 commits into
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
More details
The registry callback and shared latch preserve a single final export with bounded waiting for repeated close calls. The documented shutdown-hook scheduler limitation remains.
🤖 Bits Code Review · Commit 42a87ce
🟢 Java Benchmark SLOs — All performance SLOs passed
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. |
Remove the exporter shutdown guards production can no longer hit, as the shutdown action is only registered once the exporter has started. Document the exporter shutdown action held by the registry, share the blocking sender test setup, and test the registration on start.
What Does This Do
Replaces the
DatadogMeterProvider.shutdown()API added by #12317 with the standardjava.io.Closeableinterface. TheMeterProviderreturned byGlobalOpenTelemetrynow implementsCloseable, like the OpenTelemetry SDKSdkMeterProvider:close()performs a final export of the recorded metrics, then shuts down the OTLP metrics exporter. It waits up to 10 seconds for the final export, likeSdkMeterProvider.close(). Repeated calls wait for the same final export, which runs only once. It does nothing when the OTLP metrics exporter is not running.Motivation
dd-trace-apitypes now means they never ship and never need a deprecation cycle.java.io.Closeable, following the SDK convention whereSdkMeterProviderisCloseable. They need nodd-trace-apidependency, and theinstanceofcheck skips the no-op provider when the agent is not attached.OtelMetricRegistryit already shares withdd-trace-core. The service registers its shutdown action when it starts, soTracerAPIneeds no OpenTelemetry metrics lifecycle method.Additional Notes
close()blocks up to 10 seconds and does not report the export outcome; failures are still counted by the OTLP metrics telemetry and logged at debug level.close()waits the full 10 seconds.DatadogMeterProvider.shutdown()and needs to follow this change.🤖 Generated with Claude Code