Close pool gauge registrations on shutdown - #735
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #735 +/- ##
============================================
+ Coverage 74.54% 74.69% +0.14%
- Complexity 3654 3667 +13
============================================
Files 393 394 +1
Lines 16606 16623 +17
Branches 1756 1756
============================================
+ Hits 12379 12416 +37
+ Misses 3603 3593 -10
+ Partials 624 614 -10 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
alex268
approved these changes
Oct 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Release observable gauge callbacks when table/query session pools close, following the C# reporter registration/disposal lifecycle.
Meter.registerLongGaugereturns a closeableMetricRegistration.OpenTelemetryMeterwraps the native gauge in a privateGaugeRegistrationwith a final field and delegatesclose()directly.PoolMetricsowns its four gauge registrations; both table and query pool owners close them.Gauge names, units, values, counter paths and session/queue behavior remain unchanged. No Topic changes are included. This is the prerequisite for rebasing and correcting Topic gauges in #734 after this PR is merged.
Existing
void Meter.createLongGaugeremains source/binary compatible and is marked@Deprecated. The new method has a default implementation that calls the legacy override and returnsMetricRegistration.NOOP. Backends overrideregisterLongGaugeto support callback removal; existing custom backends keep their previous lifecycle.Validation
Java21 SDK clean install passed 69 tests: core6, table42, query21; no failures, errors or skips. This includes legacy API compatibility and callback removal.
Current JDBC source compiled all 89 production and 55 test files against the local SDK2.4.12-SNAPSHOT. Its 89 settings tests passed without failures/errors/skips, including the unchanged legacy
BadCustomMeterimplementation.Public SDK smoke with two
TableClientinstances and a real OpenTelemetry collector:NOOP registrations can be closed repeatedly. The same scenario fails when callback handles are discarded, reproducing the original leak.
The native OpenTelemetry backend logs a warning for repeated close; the wrapper adds no atomics, mutable state or duplicate-close guard.
CI compatibility
The previous JDBC
BadCustomMetercompilation failure is fixed by retaining the old void signature. JDBC sources are unchanged. Local database integration tests were not run because Docker is not running; the CI matrix will exercise the complete downstream suites.Deprecation warnings from compatibility tests and native OpenTelemetry warnings on repeated close are expected and not suppressed.