Skip to content

Commit 9a61436

Browse files
committed
Automatically disable the old ServiceTalk instrumentation for versions prior to v0.42.56
1 parent b61a8c2 commit 9a61436

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

dd-java-agent/instrumentation/servicetalk/servicetalk-0.42.0/build.gradle

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ muzzle {
88
module = 'servicetalk-concurrent-api'
99
versions = '[0.42.0,0.42.56)'
1010
}
11+
fail {
12+
group = 'io.servicetalk'
13+
module = 'servicetalk-concurrent-api'
14+
versions = '[0.42.56,]'
15+
}
1116
}
1217

1318
ext {

dd-java-agent/instrumentation/servicetalk/servicetalk-0.42.0/src/main/java/datadog/trace/instrumentation/servicetalk0_42_0/ServiceTalkInstrumentation.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package datadog.trace.instrumentation.servicetalk0_42_0;
22

33
import datadog.trace.agent.tooling.InstrumenterModule;
4+
import datadog.trace.agent.tooling.muzzle.Reference;
45
import datadog.trace.bootstrap.instrumentation.api.AgentSpan;
56
import java.util.Collections;
67
import java.util.Map;
@@ -18,13 +19,13 @@ public Map<String, String> contextStore() {
1819
}
1920

2021
@Override
21-
protected boolean defaultEnabled() {
22-
// Instrumentation for ServiceTalk prior to 0.42.56 is disabled by default to avoid the missing
23-
// private field "saved" error.
24-
// This can't be addressed by a muzzle check because there is no decent public change between
25-
// 0.42.55 and 0.42.56.
26-
// For versions prior to 0.42.56, this instrumentation must be explicitly enabled with
27-
// 'DD_INTEGRATION_SERVICETALK_ENABLED=true'.
28-
return false;
22+
public Reference[] additionalMuzzleReferences() {
23+
return new Reference[] {
24+
// This check prevents older instrumentation from being applied to ServiceTalk v0.42.56+
25+
new Reference.Builder("io.servicetalk.concurrent.api.DelegatingExecutor")
26+
// This field existed was removed in v0.42.56
27+
.withField(new String[0], 0, "delegate", "Lio/servicetalk/concurrent/api/Executor;")
28+
.build(),
29+
};
2930
}
3031
}

0 commit comments

Comments
 (0)