Add Redisson 2.3-3.17 connection pool metrics#19152
Conversation
There was a problem hiding this comment.
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
ClientConnectionsEntryconstructor to registerDbConnectionPoolMetricsandRedisClient.shutdownAsync()to unregister them. - Reads pool counters via reflection through
AsyncSemaphoreAccessor, supporting both the legacyAtomicIntegerand newerAsyncSemaphorefree-connection counters, with pending-requests support only when anAsyncSemaphoreis 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.
Pull request dashboard statusStatus last refreshed: 2026-07-26 20:39:10 UTC.
This automated status or its linked feedback items may be incorrect. If something looks wrong, please report it with the result you expected. |
Summary
Adds Redisson connection pool metrics support for Redisson versions
[2.3.0, 3.18.0).This introduces a new
redisson-metrics-2.3javaagent 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
[2.3.0, 3.18.0).ClientConnectionsEntryconstruction to register connection pool metrics from Redisson pool configuration and free connection counters.RedisClient.shutdownAsync()to unregister metrics when the client is shut down.AtomicIntegercounters andAsyncSemaphore-based counters used by newer Redisson versions in this range.Testing
Suggested validation:
./gradlew :instrumentation:redisson:redisson-metrics-2.3:javaagent:test./gradlew :instrumentation:redisson:redisson-metrics-2.3:javaagent:testStableSemconv