Skip to content

Commit adeecf1

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 adeecf1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

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
}

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)