Assert stable connection pool metric names in stable semconv mode#19011
Merged
laurit merged 2 commits intoJun 16, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a gap in connection-pool metrics tests (HikariCP and Vibur) so that post-close “no more metrics emitted” assertions validate the correct metric names under stable database semconv mode (db.client.connection.*) instead of passing vacuously by checking only legacy names.
Changes:
- Update HikariCP post-close assertions to switch between stable (
db.client.connection.*) and legacy (db.client.connections.*) metric names based onemitStableDatabaseSemconv(). - Update Vibur post-close max-connections assertion similarly to ensure stable-name metrics are actually asserted as absent after shutdown.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| instrumentation/hikaricp-3.0/testing/src/main/java/io/opentelemetry/instrumentation/hikaricp/AbstractHikariInstrumentationTest.java | Makes post-close “metrics are empty” assertions semconv-stability-aware for idle.min, max, and pending_requests. |
| instrumentation/vibur-dbcp-11.0/testing/src/main/java/io/opentelemetry/instrumentation/viburdbcp/AbstractViburInstrumentationTest.java | Makes post-close “max connections metric is empty” assertion semconv-stability-aware. |
laurit
approved these changes
Jun 16, 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.
The HikariCP and Vibur connection-pool tests verify, after closing the data source, that pool metrics stop being emitted via
waitAndAssertMetrics(..., isEmpty). Thedb.client.connection.countcheck already switches between the stable and old metric name based onemitStableDatabaseSemconv(), but the remaining post-close absence checks hardcoded the olddb.client.connections.*names:idle.min,max,pending_requestsmaxIn stable mode the old-named metrics are never emitted, so those
isEmptyassertions passed vacuously and never verified that the stable-named metric (db.client.connection.*) was actually unregistered after close.This wraps those names in the same
emitStableDatabaseSemconv()conditional already used for the count metric, matching the existing pattern in the c3p0 test (AbstractC3p0InstrumentationTest).