Skip to content

Assert stable connection pool metric names in stable semconv mode#19011

Merged
laurit merged 2 commits into
open-telemetry:mainfrom
trask:fix-connection-pool-stable-metric-tests
Jun 16, 2026
Merged

Assert stable connection pool metric names in stable semconv mode#19011
laurit merged 2 commits into
open-telemetry:mainfrom
trask:fix-connection-pool-stable-metric-tests

Conversation

@trask

@trask trask commented Jun 15, 2026

Copy link
Copy Markdown
Member

The HikariCP and Vibur connection-pool tests verify, after closing the data source, that pool metrics stop being emitted via waitAndAssertMetrics(..., isEmpty). The db.client.connection.count check already switches between the stable and old metric name based on emitStableDatabaseSemconv(), but the remaining post-close absence checks hardcoded the old db.client.connections.* names:

  • HikariCP: idle.min, max, pending_requests
  • Vibur: max

In stable mode the old-named metrics are never emitted, so those isEmpty assertions 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).

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 on emitStableDatabaseSemconv().
  • 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.

@trask trask marked this pull request as ready for review June 16, 2026 00:47
@trask trask requested a review from a team as a code owner June 16, 2026 00:47
@laurit laurit merged commit bef67de into open-telemetry:main Jun 16, 2026
95 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants