Skip to content
Merged
Show file tree
Hide file tree
Changes from 19 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
cf16c7c
Add Jedis pipeline span aggregation
trask Jun 19, 2026
1a07c7b
Drop batching from jedis-1.4; partition jedis-1.4/2.0 at the 2.0 (Res…
trask Jun 22, 2026
10cdbf3
Address review comment: simplify jedis-1.4 classLoaderMatcher comment
trask Jun 22, 2026
088bf0e
Address review comment: revert unnecessary jedis-1.4 JedisRequest/Jed…
trask Jun 22, 2026
7d4674f
Address review comment: move pipeline-capture comment inside the if
trask Jun 22, 2026
ad70298
Address review comment: name jedis-3.0 captured-requests VirtualField…
trask Jun 22, 2026
e82f9cd
Address review comment: type jedis-3.0 pipeline context with Pipeline…
trask Jun 22, 2026
b39d8fe
Address review comment: rephrase pipeline thread-local comment
trask Jun 22, 2026
7b83125
Address review comment: document why empty pipelines are not reported…
trask Jun 22, 2026
234816d
Address review comment: precompute operation name and query text in j…
trask Jun 22, 2026
9de6620
Address review comment: drop stale double-spans comment in jedis-3.0 …
trask Jun 22, 2026
7ebff14
Address review comment: name jedis-4.0 captured-requests VirtualField…
trask Jun 22, 2026
795aa64
Address review comment: precompute operation name and query text in j…
trask Jun 22, 2026
95b1a92
Address review: tighten pipeline typing where safe, refine comments
trask Jun 22, 2026
fa5ea6c
Add MULTI batch spans for Redis transactions (jedis 2.0/3.0/4.0)
trask Jun 23, 2026
3bc21f1
Add transaction discard() regression tests (jedis 2.0/3.0/4.0)
trask Jun 23, 2026
7b37832
Deprecate jedis-1.4 module and disable under v3-preview
trask Jun 23, 2026
e93a80c
Store List<JedisRequest> directly in VirtualField instead of Captured…
trask Jun 23, 2026
52dbebe
Address Jedis review feedback
trask Jun 25, 2026
f863cf1
Align Jedis batch query text limits
trask Jun 25, 2026
d8c3f15
Merge remote-tracking branch 'upstream/main' into jedis-batch-spans
trask Jun 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .fossa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -595,6 +595,9 @@ targets:
- type: gradle
path: ./
target: ':instrumentation:jedis:jedis-1.4:javaagent'
- type: gradle
path: ./
target: ':instrumentation:jedis:jedis-2.0:javaagent'
- type: gradle
path: ./
target: ':instrumentation:jedis:jedis-3.0:javaagent'
Expand Down
1 change: 1 addition & 0 deletions .github/config/latest-dep-versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,7 @@
"org.vibur:vibur-dbcp#+": "26.0",
"org.xerial:sqlite-jdbc#+": "3.53.2.0",
"redis.clients:jedis#+": "7.5.2",
"redis.clients:jedis#1.+": "1.5.2",
"redis.clients:jedis#2.+": "2.10.2",
"redis.clients:jedis#3.+": "3.10.0",
"software.amazon.awssdk.crt:aws-crt#+": "0.47.1",
Expand Down
2 changes: 2 additions & 0 deletions .github/scripts/instrumentations.sh
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ readonly INSTRUMENTATIONS=(
"jdbc:javaagent:testStableSemconv"
"jedis:jedis-1.4:javaagent:test"
"jedis:jedis-1.4:javaagent:testStableSemconv"
"jedis:jedis-2.0:javaagent:test"
"jedis:jedis-2.0:javaagent:testStableSemconv"
"jedis:jedis-3.0:javaagent:test"
"jedis:jedis-3.0:javaagent:testStableSemconv"
"jedis:jedis-4.0:javaagent:test"
Expand Down
4 changes: 3 additions & 1 deletion docs/supported-libraries.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ These are the supported libraries and frameworks:
| [JAX-WS](https://jakarta.ee/specifications/xml-web-services/2.3/apidocs/javax/xml/ws/package-summary.html) | 2.0+ (not including 3.0+ yet) | N/A | Provides `http.route` [2], Controller Spans [3] |
| [JBoss Log Manager](https://github.com/jboss-logging/jboss-logmanager) | 1.1+ | N/A | none |
| [JDBC](https://docs.oracle.com/javase/8/docs/api/java/sql/package-summary.html) | Java 8+ | [opentelemetry-jdbc](../instrumentation/jdbc/library) | [Database Client Spans], [Database Client Metrics]&nbsp;[6] |
| [Jedis](https://github.com/xetorthio/jedis) | 1.4+ | N/A | [Database Client Spans], [Database Client Metrics]&nbsp;[6] |
| [Jedis](https://github.com/xetorthio/jedis) | 1.4+ [7] | N/A | [Database Client Spans], [Database Client Metrics]&nbsp;[6] |
| [JFinal](https://github.com/jfinal/jfinal) | 3.2+ | N/A | Provides `http.route` [2], Controller Spans [3] |
| [JMS](https://javaee.github.io/javaee-spec/javadocs/javax/jms/package-summary.html) | 1.1+ | N/A | [Messaging Spans] |
| [Jodd Http](https://http.jodd.org/) | 4.2+ | N/A | [HTTP Client Spans], [HTTP Client Metrics] |
Expand Down Expand Up @@ -187,6 +187,8 @@ These are the supported libraries and frameworks:

**[6]** Database Client Metrics are available for those who opt-in to [semantic convention stability](https://opentelemetry.io/docs/specs/semconv/non-normative/db-migration/).

**[7]** When `otel.instrumentation.common.v3-preview` is enabled, Jedis instrumentation supports 2.0+.

[Elasticsearch Client Spans]: https://github.com/open-telemetry/semantic-conventions/blob/main/docs/db/elasticsearch.md
[HTTP Server Spans]: https://github.com/open-telemetry/semantic-conventions/blob/main/docs/http/http-spans.md#http-server
[HTTP Client Spans]: https://github.com/open-telemetry/semantic-conventions/blob/main/docs/http/http-spans.md#http-client-span
Expand Down
21 changes: 6 additions & 15 deletions instrumentation/jedis/jedis-1.4/javaagent/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ muzzle {
pass {
group.set("redis.clients")
module.set("jedis")
versions.set("[1.4.0,3.0.0)")
versions.set("[1.4.0,2.0.0)")
Comment thread
trask marked this conversation as resolved.
assertInverse.set(true)
}
}
Expand All @@ -19,23 +19,14 @@ dependencies {

implementation(project(":instrumentation:jedis:jedis-common-1.4:javaagent"))

testImplementation(project(":instrumentation:jedis:jedis-1.4:testing"))
testImplementation("io.opentelemetry.javaagent:opentelemetry-testing-common")
testImplementation("org.testcontainers:testcontainers")

testInstrumentation(project(":instrumentation:jedis:jedis-2.0:javaagent"))
testInstrumentation(project(":instrumentation:jedis:jedis-3.0:javaagent"))
testInstrumentation(project(":instrumentation:jedis:jedis-4.0:javaagent"))
Comment thread
trask marked this conversation as resolved.

latestDepTestLibrary("redis.clients:jedis:2.+") // see jedis-3.0 module
}

testing {
suites {
val version272 by registering(JvmTestSuite::class) {
dependencies {
implementation("redis.clients:jedis:2.7.2")
implementation(project(":instrumentation:jedis:jedis-1.4:testing"))
}
}
}
latestDepTestLibrary("redis.clients:jedis:1.+") // see jedis-2.0 module
}

tasks {
Expand All @@ -53,6 +44,6 @@ tasks {
}

check {
dependsOn(testing.suites, testStableSemconv)
dependsOn(testStableSemconv)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,30 @@
import static net.bytebuddy.matcher.ElementMatchers.not;

import com.google.auto.service.AutoService;
import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig;
import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule;
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;
import java.util.List;
import net.bytebuddy.matcher.ElementMatcher;

@Deprecated // disabled under v3-preview; to be removed in 3.0
Comment thread
trask marked this conversation as resolved.
@AutoService(InstrumentationModule.class)
public class JedisInstrumentationModule extends InstrumentationModule {

public JedisInstrumentationModule() {
super("jedis", "jedis-1.4");
}

@Override
public boolean defaultEnabled() {
// disabled under v3-preview, where jedis 1.x is no longer supported
Comment thread
trask marked this conversation as resolved.
return super.defaultEnabled() && !AgentCommonConfig.get().isV3Preview();
}

@Override
public ElementMatcher.Junction<ClassLoader> classLoaderMatcher() {
// added in 3.0
return not(hasClassesNamed("redis.clients.jedis.commands.ProtocolCommand"));
// added in 2.0
return not(hasClassesNamed("redis.clients.jedis.Response"));
Comment thread
trask marked this conversation as resolved.
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,161 @@

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Copied from instrumentation/jedis/jedis-1.4/testing/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/AbstractJedisTest.java

--- a/instrumentation/jedis/jedis-1.4/testing/src/main/java/io/opentelemetry/javaagent/instrumentation/jedis/AbstractJedisTest.java
+++ b/instrumentation/jedis/jedis-1.4/javaagent/src/test/java/io/opentelemetry/javaagent/instrumentation/jedis/v1_4/JedisClientTest.java
@@ -3,7 +3,7 @@
  * SPDX-License-Identifier: Apache-2.0
  */
 
-package io.opentelemetry.javaagent.instrumentation.jedis;
+package io.opentelemetry.javaagent.instrumentation.jedis.v1_4;
 
 import static io.opentelemetry.instrumentation.api.internal.SemconvStability.emitStableDatabaseSemconv;
 import static io.opentelemetry.instrumentation.testing.junit.db.DbClientMetricsTestUtil.assertDurationMetric;
@@ -32,7 +32,7 @@ import org.testcontainers.containers.GenericContainer;
 import redis.clients.jedis.Jedis;
 
 @SuppressWarnings("deprecation") // using deprecated semconv
-public abstract class AbstractJedisTest {
+class JedisClientTest {
   @RegisterExtension
   private static final InstrumentationExtension testing = AgentInstrumentationExtension.create();
 

package io.opentelemetry.javaagent.instrumentation.jedis.v1_4;

import io.opentelemetry.javaagent.instrumentation.jedis.AbstractJedisTest;
import static io.opentelemetry.instrumentation.api.internal.SemconvStability.emitStableDatabaseSemconv;
import static io.opentelemetry.instrumentation.testing.junit.db.DbClientMetricsTestUtil.assertDurationMetric;
import static io.opentelemetry.instrumentation.testing.junit.db.SemconvStabilityUtil.maybeStable;
import static io.opentelemetry.instrumentation.testing.junit.service.SemconvServiceStabilityUtil.maybeStablePeerService;
import static io.opentelemetry.sdk.testing.assertj.OpenTelemetryAssertions.equalTo;
import static io.opentelemetry.semconv.ServerAttributes.SERVER_ADDRESS;
import static io.opentelemetry.semconv.ServerAttributes.SERVER_PORT;
import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_OPERATION;
import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_OPERATION_NAME;
import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_STATEMENT;
import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_SYSTEM;
import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DB_SYSTEM_NAME;
import static io.opentelemetry.semconv.incubating.DbIncubatingAttributes.DbSystemNameIncubatingValues.REDIS;
import static org.assertj.core.api.Assertions.assertThat;

class JedisClientTest extends AbstractJedisTest {}
import io.opentelemetry.api.trace.SpanKind;
import io.opentelemetry.instrumentation.testing.internal.AutoCleanupExtension;
import io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension;
import io.opentelemetry.instrumentation.testing.junit.InstrumentationExtension;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.RegisterExtension;
import org.testcontainers.containers.GenericContainer;
import redis.clients.jedis.Jedis;

@SuppressWarnings("deprecation") // using deprecated semconv
class JedisClientTest {
@RegisterExtension
private static final InstrumentationExtension testing = AgentInstrumentationExtension.create();

@RegisterExtension
private static final AutoCleanupExtension cleanup = AutoCleanupExtension.create();

private static final GenericContainer<?> redisServer =
new GenericContainer<>("redis:6.2.3-alpine").withExposedPorts(6379);

private static String host;

private static int port;

private static Jedis jedis;

@BeforeAll
static void setup() {
redisServer.start();
cleanup.deferAfterAll(redisServer::stop);
host = redisServer.getHost();
port = redisServer.getMappedPort(6379);
jedis = new Jedis(host, port);
cleanup.deferAfterAll(jedis::disconnect);
}

@BeforeEach
void reset() {
jedis.select(0);
jedis.flushAll();
testing.clearData();
}

@Test
void setCommand() {
jedis.set("foo", "bar");

testing.waitAndAssertTraces(
trace ->
trace.hasSpansSatisfyingExactly(
span ->
span.hasName(emitStableDatabaseSemconv() ? "SET " + host + ":" + port : "SET")
.hasKind(SpanKind.CLIENT)
.hasAttributesSatisfyingExactly(
equalTo(maybeStable(DB_SYSTEM), REDIS),
equalTo(maybeStable(DB_STATEMENT), "SET foo ?"),
equalTo(maybeStable(DB_OPERATION), "SET"),
equalTo(maybeStablePeerService(), "test-peer-service"),
equalTo(SERVER_ADDRESS, host),
equalTo(SERVER_PORT, port))));

assertDurationMetric(
testing,
"io.opentelemetry.jedis-1.4",
DB_SYSTEM_NAME,
DB_OPERATION_NAME,
SERVER_ADDRESS,
SERVER_PORT);
}

@Test
void getCommand() {
jedis.set("foo", "bar");
String value = jedis.get("foo");

assertThat(value).isEqualTo("bar");

testing.waitAndAssertTraces(
trace ->
trace.hasSpansSatisfyingExactly(
span ->
span.hasName(emitStableDatabaseSemconv() ? "SET " + host + ":" + port : "SET")
.hasKind(SpanKind.CLIENT)
.hasAttributesSatisfyingExactly(
equalTo(maybeStable(DB_SYSTEM), REDIS),
equalTo(maybeStable(DB_STATEMENT), "SET foo ?"),
equalTo(maybeStable(DB_OPERATION), "SET"),
equalTo(maybeStablePeerService(), "test-peer-service"),
equalTo(SERVER_ADDRESS, host),
equalTo(SERVER_PORT, port))),
trace ->
trace.hasSpansSatisfyingExactly(
span ->
span.hasName(emitStableDatabaseSemconv() ? "GET " + host + ":" + port : "GET")
.hasKind(SpanKind.CLIENT)
.hasAttributesSatisfyingExactly(
equalTo(maybeStable(DB_SYSTEM), REDIS),
equalTo(maybeStable(DB_STATEMENT), "GET foo"),
equalTo(maybeStable(DB_OPERATION), "GET"),
equalTo(maybeStablePeerService(), "test-peer-service"),
equalTo(SERVER_ADDRESS, host),
equalTo(SERVER_PORT, port))));
}

@Test
void commandWithNoArguments() {
jedis.set("foo", "bar");
String value = jedis.randomKey();

assertThat(value).isEqualTo("foo");

testing.waitAndAssertTraces(
trace ->
trace.hasSpansSatisfyingExactly(
span ->
span.hasName(emitStableDatabaseSemconv() ? "SET " + host + ":" + port : "SET")
.hasKind(SpanKind.CLIENT)
.hasAttributesSatisfyingExactly(
equalTo(maybeStable(DB_SYSTEM), REDIS),
equalTo(maybeStable(DB_STATEMENT), "SET foo ?"),
equalTo(maybeStable(DB_OPERATION), "SET"),
equalTo(maybeStablePeerService(), "test-peer-service"),
equalTo(SERVER_ADDRESS, host),
equalTo(SERVER_PORT, port))),
trace ->
trace.hasSpansSatisfyingExactly(
span ->
span.hasName(
emitStableDatabaseSemconv()
? "RANDOMKEY " + host + ":" + port
: "RANDOMKEY")
.hasKind(SpanKind.CLIENT)
.hasAttributesSatisfyingExactly(
equalTo(maybeStable(DB_SYSTEM), REDIS),
equalTo(maybeStable(DB_STATEMENT), "RANDOMKEY"),
equalTo(maybeStable(DB_OPERATION), "RANDOMKEY"),
equalTo(maybeStablePeerService(), "test-peer-service"),
equalTo(SERVER_ADDRESS, host),
equalTo(SERVER_PORT, port))));
}
}

This file was deleted.

9 changes: 0 additions & 9 deletions instrumentation/jedis/jedis-1.4/testing/build.gradle.kts

This file was deleted.

Loading