Skip to content

Commit 856a656

Browse files
committed
Extend Jedis 4.x plugin to support Jedis 5.x
Jedis 5.x is API-compatible with 4.x (all intercepted classes and methods unchanged). The only blocker was the witness method: Pipeline.persist(1 arg) was no longer declared on Pipeline in 5.x (moved to PipeliningBase parent). Fix: change witness to Connection.executeCommand(1 arg) which is declared in both 4.x and 5.x but not in 3.x, correctly distinguishing the versions. Resolves apache/skywalking#11747 Locally verified: Jedis 5.2.0 passed.
1 parent a9e1e14 commit 856a656

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Release Notes.
2020
* Extend Spring Kafka plugin to support Spring Kafka 2.4 -> 2.9 and 3.0 -> 3.3.
2121
* Enhance test/plugin/run.sh to support extra Maven properties per version in support-version.list (format: version,key=value).
2222
* Add MariaDB 3.x plugin (all classes renamed in 3.x).
23+
* Extend Jedis 4.x plugin to support Jedis 5.x (fix witness method for 5.x compatibility).
2324

2425
All issues and pull requests are [here](https://github.com/apache/skywalking/milestone/249?closed=1)
2526

apm-sniffer/apm-sdk-plugin/jedis-plugins/jedis-4.x-plugin/src/main/java/org/apache/skywalking/apm/plugin/jedis/v4/define/AbstractWitnessInstrumentation.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,11 @@ protected String[] witnessClasses() {
3535

3636
@Override
3737
protected List<WitnessMethod> witnessMethods() {
38+
// Connection.executeCommand(CommandObject) exists in Jedis 4.x+ and 5.x,
39+
// but not in 3.x. Previous witness Pipeline.persist(1) broke in 5.x
40+
// because persist moved from Pipeline to PipeliningBase parent class.
3841
return Collections.singletonList(new WitnessMethod(
39-
"redis.clients.jedis.Pipeline",
40-
named("persist").and(takesArguments(1))));
42+
"redis.clients.jedis.Connection",
43+
named("executeCommand").and(takesArguments(1))));
4144
}
4245
}

docs/en/setup/service-agent/java-agent/Supported-list.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ metrics based on the tracing data.
8888
* NoSQL
8989
* [aerospike](https://github.com/aerospike/aerospike-client-java) 3.x -> 6.x
9090
* Redis
91-
* [Jedis](https://github.com/xetorthio/jedis) 2.x-4.x
91+
* [Jedis](https://github.com/xetorthio/jedis) 2.x-5.x
9292
* [Redisson](https://github.com/redisson/redisson) Easy Java Redis client 3.5.0 -> 3.30.0
9393
* [Lettuce](https://github.com/lettuce-io/lettuce-core) 5.x -> 6.7.1
9494
* [MongoDB Java Driver](https://github.com/mongodb/mongo-java-driver) 2.13-2.14, 3.4.0-3.12.7, 4.0.0-5.5.x

test/plugin/scenarios/jedis-4.x-scenario/support-version.list

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@
1919
4.2.3
2020
4.1.1
2121
4.0.1
22+
5.2.0

0 commit comments

Comments
 (0)