Skip to content

Commit 18bda7f

Browse files
committed
fix build
1 parent 3bc435b commit 18bda7f

File tree

3 files changed

+22
-9
lines changed

3 files changed

+22
-9
lines changed

dd-java-agent/instrumentation/jetty-client-9.1/build.gradle

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,20 +52,26 @@ addTestSuiteForDir('latestDepTest', 'jetty10')
5252
it.javaLauncher = getJavaLauncherFor(11)
5353
}
5454

55-
configurations{
55+
configurations {
5656
all {
5757
resolutionStrategy {
5858
force "org.slf4j:slf4j-api:${versions.slf4j}"
5959
}
6060
}
61+
testRuntimeClasspath {
62+
resolutionStrategy {
63+
force group: 'org.eclipse.jetty', name: 'jetty-client', version: '9.1.0.v20131115'
64+
force group: 'org.eclipse.jetty', name: 'jetty-util', version: '9.1.0.v20131115'
65+
force group: 'org.eclipse.jetty', name: 'jetty-io', version: '9.1.0.v20131115'
66+
}
67+
}
6168
}
6269

6370
dependencies {
6471
compileOnly group: 'org.eclipse.jetty', name: 'jetty-client', version: '9.1.0.v20131115'
65-
6672
testImplementation(project(path:':dd-java-agent:testing', configuration: 'shadow')) {
6773
// explicitly declared below.
68-
exclude module: 'jetty-server'
74+
exclude group: 'org.eclipse.jetty'
6975
}
7076
testImplementation group: 'javax.servlet', name: 'javax.servlet-api', version: '3.1.0'
7177
testImplementation project(':dd-java-agent:instrumentation:jetty-util')

dd-java-agent/instrumentation/jetty-client-9.1/src/main/java/datadog/trace/instrumentation/jetty_client/JettyClientDecorator.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
import org.slf4j.LoggerFactory;
1313

1414
public class JettyClientDecorator extends HttpClientDecorator<Request, Response> {
15-
private static final MethodHandle HANDLE = createMethodHandle();
1615
private static final Logger LOGGER = LoggerFactory.getLogger(JettyClientDecorator.class);
16+
private static final MethodHandle HANDLE = createMethodHandle();
1717
public static final CharSequence JETTY_CLIENT = UTF8BytesString.create("jetty-client");
1818
public static final JettyClientDecorator DECORATE = new JettyClientDecorator();
1919
public static final CharSequence HTTP_REQUEST = UTF8BytesString.create(DECORATE.operationName());
@@ -66,11 +66,13 @@ protected String getResponseHeader(Response response, String headerName) {
6666
}
6767

6868
private String getHeaderValue(final HttpFields fields, final String headerName) {
69-
try {
70-
return (String) HANDLE.invokeExact(fields, headerName);
71-
} catch (Throwable t) {
72-
// probably we should log here but in case of issue we'll flood
73-
// however muzzle should already protect us from falling here
69+
if (HANDLE != null) {
70+
try {
71+
return (String) HANDLE.invokeExact(fields, headerName);
72+
} catch (Throwable t) {
73+
// probably we should log here but in case of issue we'll flood
74+
// however muzzle should already protect us from falling here
75+
}
7476
}
7577
return null;
7678
}

dd-java-agent/instrumentation/jetty-client-9.1/src/main/java/datadog/trace/instrumentation/jetty_client/JettyClientInstrumentation.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ public void methodAdvice(MethodTransformer transformer) {
9191
public String[] muzzleIgnoredClassNames() {
9292
return new String[] {
9393
"org.eclipse.jetty.http.HttpFields",
94+
// add also helpers
95+
packageName + ".JettyClientDecorator",
96+
packageName + ".HeadersInjectAdapter",
97+
packageName + ".CallbackWrapper",
98+
packageName + ".SpanFinishingCompleteListener",
9499
};
95100
}
96101

0 commit comments

Comments
 (0)