Add OpenTelemetry metrics lifecycle controls - #12317
Conversation
This comment has been minimized.
This comment has been minimized.
🟢 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. |
|
Note from Claude (reviewing on behalf of @dougqh): not a blocker, but worth thinking through before this lands. Neither
For the automatic path ( But it cuts against the PR's own motivation: a short-lived job calling Worth considering wrapping the flush/shutdown future with |
What Does This Do
Adds public
OpenTelemetryMetrics.forceFlush()andshutdown()methods. Both returnCompletableFuture<Boolean>and finish after the OTLP metrics transport reports its result.Periodic exports, explicit flushes, and the final shutdown export run on one owned executor. Shutdown closes the exporter once and returns a cached terminal result. The existing void
flushMetrics()bridge remains binary compatible.Motivation
Short-lived Java jobs can finish before the periodic OTel metrics interval. They need a supported call that waits for pending custom metrics to leave the process.
Additional Notes
falseand record paired export-attempt and export-failure telemetry.OpenTelemetryMetricsandInternalTracer.Contributor Checklist
type:and (comp:orinst:) labels in addition to any other useful labelsclose,fix, or any linking keywords when referencing an issueUse
solvesinstead, and assign the PR milestone to the issueJira ticket: N/A