fix: support jetty 8+, sparkjava 2.5+
RENAME
dd-java-agent/instrumentation/jetty-9/jetty-9.gradle
dd-java-agent/instrumentation/jetty-8/jetty-8.gradle
apply plugin: 'version-scan'
versionScan {
- group = "javax.servlet"
- module = 'javax.servlet-api'
- legacyModule = "servlet-api"
+ group = "org.eclipse.jetty.server"
+ module = 'org.eclipse.jetty.server-Handler'
versions = "[3.0,)"
verifyPresent = [
"javax.servlet.AsyncEvent" : null,
@@ -27,8 +26,8 @@ dependencies {
compile deps.autoservice
testCompile project(':dd-java-agent:testing')
- testCompile group: 'org.eclipse.jetty', name: 'jetty-server', version: '9.4.6.v20170531'
- testCompile group: 'org.eclipse.jetty', name: 'jetty-servlet', version: '9.4.6.v20170531'
+ testCompile group: 'org.eclipse.jetty', name: 'jetty-server', version: '8.0.0.v20110901'
+ testCompile group: 'org.eclipse.jetty', name: 'jetty-servlet', version: '8.0.0.v20110901'
testCompile project(':dd-java-agent:instrumentation:okhttp-3') // used in the tests
testCompile group: 'com.squareup.okhttp3', name: 'okhttp', version: '3.6.0'

RENAME
dd-java-agent/instrumentation/jetty-9/src/main/java/datadog/trace/instrumentation/jetty9/HandlerInstrumentation.java
dd-java-agent/instrumentation/jetty-8/src/main/java/datadog/trace/instrumentation/jetty8/HandlerInstrumentation.java
-package datadog.trace.instrumentation.jetty9;
+package datadog.trace.instrumentation.jetty8;
import static datadog.trace.agent.tooling.ClassLoaderMatcher.classLoaderHasClasses;
import static io.opentracing.log.Fields.ERROR_OBJECT;
@@ -33,7 +33,12 @@ public final class HandlerInstrumentation extends Instrumenter.Configurable {
public static final String SERVLET_OPERATION_NAME = "jetty.request";
public HandlerInstrumentation() {
- super("jetty", "jetty-9");
+ super("jetty", "jetty-8");
+ }
+
+ @Override
+ public boolean defaultEnabled() {
+ return false;
}
@Override
@@ -69,6 +74,10 @@ public final class HandlerInstrumentation extends Instrumenter.Configurable {
@Advice.OnMethodEnter(suppress = Throwable.class)
public static Scope startSpan(
@Advice.Argument(0) final String target, @Advice.Argument(2) final HttpServletRequest req) {
+ if (GlobalTracer.get().activeSpan() != null) {
+ // Tracing might already be applied. If so ignore this.
+ return null;
+ }
final SpanContext extractedContext =
GlobalTracer.get()

RENAME
dd-java-agent/instrumentation/sparkjava-2.7/sparkjava.gradle
dd-java-agent/instrumentation/sparkjava-2.5/sparkjava-2.5.gradle
apply from: "${rootDir}/gradle/java.gradle"
-if (JavaVersion.isJava8Compatible()) {
+if (JavaVersion.current().isJava8Compatible()) {
sourceSets {
test {
groovy {
@@ -12,22 +12,16 @@ if (JavaVersion.isJava8Compatible()) {
}
dependencies {
- compileOnly group: 'javax.servlet', name: 'javax.servlet-api', version: '3.1.0'
- compile('io.opentracing.contrib:opentracing-web-servlet-filter:0.1.0') {
- transitive = false
- }
-
compile project(':dd-java-agent:agent-tooling')
compile deps.bytebuddy
compile deps.opentracing
compile deps.autoservice
- compile group: 'com.sparkjava', name: 'spark-core', version: '2.7.1'
+ compile group: 'com.sparkjava', name: 'spark-core', version: '2.5'
+ testCompile project(':dd-java-agent:instrumentation:jetty-8')
testCompile project(':dd-java-agent:testing')
- // Uses jetty-9 instrumentation for requests
- testCompile project(':dd-java-agent:instrumentation:jetty-9')
testCompile group: 'com.squareup.okhttp3', name: 'okhttp', version: '3.6.0'
}

RENAME
dd-java-agent/instrumentation/sparkjava-2.7/src/main/java/datadog/trace/instrumentation/sparkjava/RoutesInstrumentation.java
dd-java-agent/instrumentation/sparkjava-2.5/src/main/java/datadog/trace/instrumentation/sparkjava/RoutesInstrumentation.java
RENAME
dd-java-agent/instrumentation/sparkjava-2.7/src/test/groovy/SparkJavaBasedTest.groovy
dd-java-agent/instrumentation/sparkjava-2.5/src/test/groovy/SparkJavaBasedTest.groovy
RENAME
dd-java-agent/instrumentation/sparkjava-2.7/src/test/java/TestSparkJavaApplication.java
dd-java-agent/instrumentation/sparkjava-2.5/src/test/java/TestSparkJavaApplication.java
MODIFY
settings.gradle
settings.gradle
@@ -21,7 +21,7 @@ include ':dd-java-agent:instrumentation:java-concurrent:akka-testing'
include ':dd-java-agent:instrumentation:jboss-classloading'
include ':dd-java-agent:instrumentation:jdbc'
include ':dd-java-agent:instrumentation:jedis-1.4'
-include ':dd-java-agent:instrumentation:jetty-9'
+include ':dd-java-agent:instrumentation:jetty-8'
include ':dd-java-agent:instrumentation:jms-1'
include ':dd-java-agent:instrumentation:jms-2'
include ':dd-java-agent:instrumentation:kafka-clients-0.11'
@@ -35,7 +35,7 @@ include ':dd-java-agent:instrumentation:play-2.4:play-2.6-testing'
include ':dd-java-agent:instrumentation:ratpack-1.4'
include ':dd-java-agent:instrumentation:servlet-2'
include ':dd-java-agent:instrumentation:servlet-3'
-include ':dd-java-agent:instrumentation:sparkjava-2.7'
+include ':dd-java-agent:instrumentation:sparkjava-2.5'
include ':dd-java-agent:instrumentation:spring-web'
include ':dd-java-agent:instrumentation:trace-annotation'

fix: support jetty 8+, sparkjava 2.5+