Update Jedis to stable database semconv#18808
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates Jedis instrumentations to align with stable database semantic conventions by enriching span attributes and span naming (primarily for Jedis 4.0), and adjusts tests to validate the new stable-semconv behavior.
Changes:
- Jedis 4.0: capture server address/port + configured database index and emit them via stable semconv (including updated span naming).
- Jedis 1.4/3.0: update span naming behavior under stable database semconv.
- Tests: reset Redis DB to index 0 between tests and add/extend stable-semconv assertions.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| instrumentation/jedis/jedis-common-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/common/v1_4/JedisRequestContext.java | Adds helper to derive a database index for stable semconv emission. |
| instrumentation/jedis/jedis-4.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/jedis/v4_0/Jedis40ClientTest.java | Updates assertions for stable DB semconv span names/attributes and adds db.namespace scenarios. |
| instrumentation/jedis/jedis-4.0/javaagent/src/main/java/redis/clients/jedis/DefaultJedisSocketFactoryUtil.java | Injected helper to access Jedis package-private host/port from socket factory. |
| instrumentation/jedis/jedis-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v4_0/JedisSingletons.java | Replaces generic DB span-name extractor with Redis-specific stable-semconv span naming; adds VirtualField for connection metadata. |
| instrumentation/jedis/jedis-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v4_0/JedisRequest.java | Extends request model to carry server/db metadata needed for stable semconv. |
| instrumentation/jedis/jedis-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v4_0/JedisInstrumentationModule.java | Enables injected helper class loading for Jedis 4.0 via experimental module hooks. |
| instrumentation/jedis/jedis-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v4_0/JedisDbAttributesGetter.java | Implements stable-semconv getters for db.namespace and server.* attributes. |
| instrumentation/jedis/jedis-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v4_0/JedisConnectionInstrumentation.java | Captures connection metadata at construction and threads connection through request creation. |
| instrumentation/jedis/jedis-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v4_0/JedisConnectionInfo.java | Stores extracted server address/port and configured database index for reuse per connection. |
| instrumentation/jedis/jedis-3.0/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/jedis/v3_0/Jedis30ClientTest.java | Ensures tests reset Redis DB index to 0 between runs. |
| instrumentation/jedis/jedis-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v3_0/JedisSingletons.java | Updates span naming to match stable DB semconv behavior. |
| instrumentation/jedis/jedis-1.4/testing/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/AbstractJedisTest.java | Ensures tests reset Redis DB index to 0 between runs. |
| instrumentation/jedis/jedis-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v1_4/JedisSingletons.java | Updates span naming to match stable DB semconv behavior. |
CI compiled the Jedis 4 javaagent against a Jedis version where JedisClientConfig#getDatabase returns Integer, while the captured database index is stored as Long. Convert the returned database index with Long.valueOf(...) so the source compiles against both int and Integer signatures. Validation: .\gradlew.bat :instrumentation:jedis:jedis-4.0:javaagent:compileJava Validation: .\gradlew.bat :instrumentation:jedis:jedis-4.0:javaagent:compileJava -PtestLatestDeps=true Validation: .\gradlew.bat :instrumentation:jedis:jedis-4.0:javaagent:muzzle Validation: .\gradlew.bat :instrumentation:jedis:jedis-4.0:javaagent:muzzle -PtestLatestDeps=true
Jedis 4 stable semconv tests expected db.namespace on spans and metrics from the default connection, but stable Redis telemetry only emits db.namespace when the Jedis client is explicitly configured with a database index. Update the span assertions and duration metric expectation to match the emitted attributes. Validation: .\gradlew.bat :instrumentation:jedis:jedis-4.0:javaagent:testStableSemconv .\gradlew.bat :instrumentation:jedis:jedis-4.0:javaagent:testStableSemconv -PtestLatestDeps=true
trask
marked this pull request as ready for review
June 8, 2026 04:27
…space # Conflicts: # instrumentation/jedis/jedis-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v1_4/JedisSingletons.java # instrumentation/jedis/jedis-3.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v3_0/JedisSingletons.java # instrumentation/jedis/jedis-4.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/v4_0/JedisSingletons.java
laurit
reviewed
Jun 10, 2026
| Instrumenter.<JedisRequest, Void>builder( | ||
| GlobalOpenTelemetry.get(), | ||
| INSTRUMENTATION_NAME, | ||
| DbClientSpanNameExtractor.create(dbAttributesGetter)) |
Contributor
There was a problem hiding this comment.
not really necessary since namespace is not implemented
laurit
reviewed
Jun 10, 2026
| GlobalOpenTelemetry.get(), | ||
| INSTRUMENTATION_NAME, | ||
| DbClientSpanNameExtractor.create(dbAttributesGetter)) | ||
| request -> spanName(dbAttributesGetter, request)) |
Contributor
There was a problem hiding this comment.
wondering maybe it would be better to use something like
JedisDbAttributesGetter spanNameAttributesGetter = new JedisDbAttributesGetter() {
@Override
@Nullable
public String getDbNamespace(JedisRequest request) {
return null;
}
};
...
DbClientSpanNameExtractor.create(spanNameAttributesGetter))
so that the whole name logic wouldn't need to be reimplemented.
laurit
approved these changes
Jun 10, 2026
trask
enabled auto-merge (squash)
June 10, 2026 13:58
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.
Update the Jedis 4.0 javaagent instrumentation to fill in the remaining stable database semantic convention fields that require connection metadata:
db.namespacefrom the configured Redis database indexserver.addressserver.portThis also updates stable database span names to include the server endpoint fallback and adds the Jedis connection metadata plumbing needed to capture those values for command spans.