Move @Trace and JDBC instrumentation to individual modules

This commit is contained in:
Tyler Benson 2018-01-04 16:18:31 +10:00
parent cf6388808a
commit eeb17c4522
7 changed files with 29 additions and 6 deletions

View File

@ -0,0 +1,10 @@
apply from: "${rootDir}/gradle/java.gradle"
dependencies {
compile project(':dd-trace')
compile project(':dd-java-agent:tooling')
compile deps.bytebuddy
compile deps.opentracing
compile deps.autoservice
}

View File

@ -1,4 +1,4 @@
package com.datadoghq.agent.instrumentation.jdbc;
package dd.trace.instrumentation.jdbc;
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
import static net.bytebuddy.matcher.ElementMatchers.isConstructor;
@ -64,7 +64,7 @@ public final class ConnectionInstrumentation implements Instrumenter {
}
connectionInfo.put(connection, new DBInfo(sanitizedURL, type, user));
}
} catch (Throwable t) {
} catch (final Throwable t) {
// object may not be fully initialized.
// calling constructor will populate map
}

View File

@ -1,4 +1,4 @@
package com.datadoghq.agent.instrumentation.jdbc;
package dd.trace.instrumentation.jdbc;
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
import static net.bytebuddy.matcher.ElementMatchers.isInterface;

View File

@ -1,4 +1,4 @@
package com.datadoghq.agent.instrumentation.jdbc;
package dd.trace.instrumentation.jdbc;
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
import static net.bytebuddy.matcher.ElementMatchers.isInterface;

View File

@ -1,4 +1,4 @@
package com.datadoghq.agent.instrumentation.annotation;
package dd.trace.instrumentation.trace_annotation;
import static net.bytebuddy.matcher.ElementMatchers.declaresMethod;
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
@ -37,7 +37,7 @@ public final class TraceAnnotationInstrumentation implements Instrumenter {
@Advice.OnMethodEnter(suppress = Throwable.class)
public static ActiveSpan startSpan(@Advice.Origin final Method method) {
final Trace trace = method.getAnnotation(Trace.class);
String operationName = trace.operationName();
String operationName = trace == null ? null : trace.operationName();
if (operationName == null || operationName.isEmpty()) {
operationName = method.getDeclaringClass().getName() + "." + method.getName();
}

View File

@ -0,0 +1,11 @@
apply from: "${rootDir}/gradle/java.gradle"
dependencies {
compile project(':dd-trace')
compile project(':dd-trace-annotations')
compile project(':dd-java-agent:tooling')
compile deps.bytebuddy
compile deps.opentracing
compile deps.autoservice
}

View File

@ -18,6 +18,7 @@ include ':dd-trace-annotations'
include ':dd-java-agent:integrations:apache-httpclient-4.3'
include ':dd-java-agent:integrations:aws-sdk'
include ':dd-java-agent:integrations:datastax-cassandra-3.2'
include ':dd-java-agent:integrations:jdbc'
include ':dd-java-agent:integrations:jms-1'
include ':dd-java-agent:integrations:jms-2'
include ':dd-java-agent:integrations:mongo-3.1'
@ -26,6 +27,7 @@ include ':dd-java-agent:integrations:okhttp-3'
include ':dd-java-agent:integrations:servlet-2'
include ':dd-java-agent:integrations:servlet-3'
include ':dd-java-agent:integrations:spring-web'
include ':dd-java-agent:integrations:trace-annotation'
def setBuildFile(project) {
project.buildFileName = "${project.name}.gradle"