Skip to content

Commit 1e8200d

Browse files
authored
Merge pull request #182 from DataDog/tyler/move-inst
Move @trace and JDBC instrumentation to individual modules
2 parents cf63888 + eeb17c4 commit 1e8200d

File tree

7 files changed

+29
-6
lines changed

7 files changed

+29
-6
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apply from: "${rootDir}/gradle/java.gradle"
2+
3+
dependencies {
4+
compile project(':dd-trace')
5+
compile project(':dd-java-agent:tooling')
6+
7+
compile deps.bytebuddy
8+
compile deps.opentracing
9+
compile deps.autoservice
10+
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.datadoghq.agent.instrumentation.jdbc;
1+
package dd.trace.instrumentation.jdbc;
22

33
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
44
import static net.bytebuddy.matcher.ElementMatchers.isConstructor;
@@ -64,7 +64,7 @@ public static void addDBInfo(@Advice.This final Connection connection) {
6464
}
6565
connectionInfo.put(connection, new DBInfo(sanitizedURL, type, user));
6666
}
67-
} catch (Throwable t) {
67+
} catch (final Throwable t) {
6868
// object may not be fully initialized.
6969
// calling constructor will populate map
7070
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.datadoghq.agent.instrumentation.jdbc;
1+
package dd.trace.instrumentation.jdbc;
22

33
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
44
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.datadoghq.agent.instrumentation.jdbc;
1+
package dd.trace.instrumentation.jdbc;
22

33
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
44
import static net.bytebuddy.matcher.ElementMatchers.isInterface;

dd-java-agent/src/main/java/com/datadoghq/agent/instrumentation/annotation/TraceAnnotationInstrumentation.java renamed to dd-java-agent/integrations/trace-annotation/src/main/java/dd/trace/instrumentation/trace_annotation/TraceAnnotationInstrumentation.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package com.datadoghq.agent.instrumentation.annotation;
1+
package dd.trace.instrumentation.trace_annotation;
22

33
import static net.bytebuddy.matcher.ElementMatchers.declaresMethod;
44
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
@@ -37,7 +37,7 @@ public static class TraceAdvice {
3737
@Advice.OnMethodEnter(suppress = Throwable.class)
3838
public static ActiveSpan startSpan(@Advice.Origin final Method method) {
3939
final Trace trace = method.getAnnotation(Trace.class);
40-
String operationName = trace.operationName();
40+
String operationName = trace == null ? null : trace.operationName();
4141
if (operationName == null || operationName.isEmpty()) {
4242
operationName = method.getDeclaringClass().getName() + "." + method.getName();
4343
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apply from: "${rootDir}/gradle/java.gradle"
2+
3+
dependencies {
4+
compile project(':dd-trace')
5+
compile project(':dd-trace-annotations')
6+
compile project(':dd-java-agent:tooling')
7+
8+
compile deps.bytebuddy
9+
compile deps.opentracing
10+
compile deps.autoservice
11+
}

settings.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ include ':dd-trace-annotations'
1818
include ':dd-java-agent:integrations:apache-httpclient-4.3'
1919
include ':dd-java-agent:integrations:aws-sdk'
2020
include ':dd-java-agent:integrations:datastax-cassandra-3.2'
21+
include ':dd-java-agent:integrations:jdbc'
2122
include ':dd-java-agent:integrations:jms-1'
2223
include ':dd-java-agent:integrations:jms-2'
2324
include ':dd-java-agent:integrations:mongo-3.1'
@@ -26,6 +27,7 @@ include ':dd-java-agent:integrations:okhttp-3'
2627
include ':dd-java-agent:integrations:servlet-2'
2728
include ':dd-java-agent:integrations:servlet-3'
2829
include ':dd-java-agent:integrations:spring-web'
30+
include ':dd-java-agent:integrations:trace-annotation'
2931

3032
def setBuildFile(project) {
3133
project.buildFileName = "${project.name}.gradle"

0 commit comments

Comments
 (0)