Skip to content

Add Redisson 2.3-3.17 connection pool metrics#19152

Open
YaoYingLong wants to merge 5 commits into
open-telemetry:mainfrom
YaoYingLong:feature/redisson-metrics-2.3
Open

Add Redisson 2.3-3.17 connection pool metrics#19152
YaoYingLong wants to merge 5 commits into
open-telemetry:mainfrom
YaoYingLong:feature/redisson-metrics-2.3

Conversation

@YaoYingLong

Copy link
Copy Markdown
Contributor

Summary

Adds Redisson connection pool metrics support for Redisson versions [2.3.0, 3.18.0).

This introduces a new redisson-metrics-2.3 javaagent instrumentation module that reports database connection pool metrics for Redisson pools, including used/idle connections, configured min/max pool sizes, and pending connection requests when the underlying Redisson version exposes that information.

Changes

  • Add a new Redisson metrics instrumentation module for versions [2.3.0, 3.18.0).
  • Instrument ClientConnectionsEntry construction to register connection pool metrics from Redisson pool configuration and free connection counters.
  • Instrument RedisClient.shutdownAsync() to unregister metrics when the client is shut down.
  • Support both legacy AtomicInteger counters and AsyncSemaphore-based counters used by newer Redisson versions in this range.
  • Add Redis Testcontainers coverage for Redisson connection pool metrics, including stable database semantic conventions.

Testing

Suggested validation:

  • ./gradlew :instrumentation:redisson:redisson-metrics-2.3:javaagent:test
  • ./gradlew :instrumentation:redisson:redisson-metrics-2.3:javaagent:testStableSemconv

@YaoYingLong
YaoYingLong requested a review from a team as a code owner July 9, 2026 05:44
Copilot AI review requested due to automatic review settings July 9, 2026 05:44

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 adds a new redisson-metrics-2.3 javaagent instrumentation module that emits database connection pool metrics (used/idle connections, min/max pool sizes, and pending requests) for Redisson versions [2.3.0, 3.18.0). It fills a gap in the existing Redisson instrumentation (which only provides client spans/metrics for 3.0+) by instrumenting the internal ClientConnectionsEntry construction and RedisClient.shutdownAsync() lifecycle, mirroring the established connection-pool-metrics pattern used by the c3p0 and Tomcat JDBC modules.

Changes:

  • New instrumentation module instruments the 7-arg ClientConnectionsEntry constructor to register DbConnectionPoolMetrics and RedisClient.shutdownAsync() to unregister them.
  • Reads pool counters via reflection through AsyncSemaphoreAccessor, supporting both the legacy AtomicInteger and newer AsyncSemaphore free-connection counters, with pending-requests support only when an AsyncSemaphore is present.
  • Adds Testcontainers-based coverage (default 2.3.0 and latest 3.17.x), plus build/config/docs wiring (settings, FOSSA, CI instrumentation list, latest-dep pin, supported-libraries doc).

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated no comments.

Show a summary per file
File Description
settings.gradle.kts Registers the new javaagent subproject
instrumentation/redisson/redisson-metrics-2.3/metadata.yaml Declares pool metrics + semconv-stability config (matches tomcat-jdbc)
.../RedissonMetricsInstrumentationModule.java Module wiring; classloader matcher scoped to org.redisson.pubsub.AsyncSemaphore
.../ClientConnectionsEntryInstrumentation.java Constructor advice to register pool metrics
.../RedisClientInstrumentation.java shutdownAsync() advice to unregister metrics
.../RedissonConnectionPoolMetrics.java Registers/records the pool metric instruments, identity-keyed callback map
.../AsyncSemaphoreAccessor.java Reflection helper for free-connection and pending-request counters
.../RedissonConnectionPoolMetricsTest.java Testcontainers coverage for registration/unregistration
.../javaagent/build.gradle.kts Muzzle range [2.3.0,3.18.0), latest-dep cap at 3.17, stable-semconv task
docs/supported-libraries.md Documents 2.3+ pool metrics through 3.17.x
.github/scripts/instrumentations.sh Adds test/testStableSemconv jobs
.github/config/latest-dep-versions.json Pins redisson#3.17.+ to 3.17.7
.fossa.yml Adds FOSSA target for the new module

I reviewed the metric-recording logic, the identity-key callback map (matches the c3p0/Tomcat pattern), the reflection accessor's null/exception guarding, the Byte Buddy matchers (7-arg constructor, shutdownAsync()), and the test conventions (AssertJ, catch-variable naming, latest-deps gating) and did not find concrete defects on the changed lines. That said, correctness here depends heavily on internal Redisson implementation details (field names freeConnectionsCounter/counter/listeners and the exact constructor signature) that vary across the wide [2.3.0, 3.18.0) range but are only exercised at two version points, which warrants human judgment.

@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Jul 13, 2026

Copy link
Copy Markdown

Pull request dashboard status

Status last refreshed: 2026-07-26 20:39:10 UTC.

  • Waiting on: Reviewers
  • Next step: Review the latest changes.

This automated status or its linked feedback items may be incorrect. If something looks wrong, please report it with the result you expected.

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