Move common instrumentation advice settings into DDAdvice
This commit is contained in:
parent
6fa779aa8f
commit
34791bbdbf
|
@ -1,11 +1,11 @@
|
||||||
package dd.inst.apachehttpclient;
|
package dd.inst.apachehttpclient;
|
||||||
|
|
||||||
import static dd.trace.ClassLoaderMatcher.classLoaderHasClasses;
|
import static dd.trace.ClassLoaderMatcher.classLoaderHasClasses;
|
||||||
import static dd.trace.ExceptionHandlers.defaultExceptionHandler;
|
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.*;
|
import static net.bytebuddy.matcher.ElementMatchers.*;
|
||||||
|
|
||||||
import com.datadoghq.agent.integration.DDTracingClientExec;
|
import com.datadoghq.agent.integration.DDTracingClientExec;
|
||||||
import com.google.auto.service.AutoService;
|
import com.google.auto.service.AutoService;
|
||||||
|
import dd.trace.DDAdvice;
|
||||||
import dd.trace.Instrumenter;
|
import dd.trace.Instrumenter;
|
||||||
import io.opentracing.util.GlobalTracer;
|
import io.opentracing.util.GlobalTracer;
|
||||||
import net.bytebuddy.agent.builder.AgentBuilder;
|
import net.bytebuddy.agent.builder.AgentBuilder;
|
||||||
|
@ -32,11 +32,10 @@ public class ApacheHttpClientInstrumentation implements Instrumenter {
|
||||||
"org.apache.http.conn.routing.HttpRoute",
|
"org.apache.http.conn.routing.HttpRoute",
|
||||||
"org.apache.http.impl.execchain.ClientExecChain"))
|
"org.apache.http.impl.execchain.ClientExecChain"))
|
||||||
.transform(
|
.transform(
|
||||||
new AgentBuilder.Transformer.ForAdvice()
|
DDAdvice.create()
|
||||||
.advice(
|
.advice(
|
||||||
isMethod().and(named("decorateProtocolExec")),
|
isMethod().and(named("decorateProtocolExec")),
|
||||||
ApacheHttpClientAdvice.class.getName())
|
ApacheHttpClientAdvice.class.getName()))
|
||||||
.withExceptionHandler(defaultExceptionHandler()))
|
|
||||||
.asDecorator();
|
.asDecorator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package dd.inst.aws;
|
package dd.inst.aws;
|
||||||
|
|
||||||
import static dd.trace.ClassLoaderMatcher.classLoaderHasClasses;
|
import static dd.trace.ClassLoaderMatcher.classLoaderHasClasses;
|
||||||
import static dd.trace.ExceptionHandlers.defaultExceptionHandler;
|
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
|
import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
|
||||||
|
@ -9,6 +8,7 @@ import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
|
||||||
import com.amazonaws.client.builder.AwsClientBuilder;
|
import com.amazonaws.client.builder.AwsClientBuilder;
|
||||||
import com.amazonaws.handlers.RequestHandler2;
|
import com.amazonaws.handlers.RequestHandler2;
|
||||||
import com.google.auto.service.AutoService;
|
import com.google.auto.service.AutoService;
|
||||||
|
import dd.trace.DDAdvice;
|
||||||
import dd.trace.Instrumenter;
|
import dd.trace.Instrumenter;
|
||||||
import io.opentracing.contrib.aws.TracingRequestHandler;
|
import io.opentracing.contrib.aws.TracingRequestHandler;
|
||||||
import io.opentracing.util.GlobalTracer;
|
import io.opentracing.util.GlobalTracer;
|
||||||
|
@ -30,11 +30,10 @@ public final class AWSClientInstrumentation implements Instrumenter {
|
||||||
"com.amazonaws.http.client.HttpClientFactory",
|
"com.amazonaws.http.client.HttpClientFactory",
|
||||||
"com.amazonaws.http.apache.utils.ApacheUtils"))
|
"com.amazonaws.http.apache.utils.ApacheUtils"))
|
||||||
.transform(
|
.transform(
|
||||||
new AgentBuilder.Transformer.ForAdvice()
|
DDAdvice.create()
|
||||||
.advice(
|
.advice(
|
||||||
named("build").and(takesArguments(0)).and(isPublic()),
|
named("build").and(takesArguments(0)).and(isPublic()),
|
||||||
AWSClientAdvice.class.getName())
|
AWSClientAdvice.class.getName()))
|
||||||
.withExceptionHandler(defaultExceptionHandler()))
|
|
||||||
.asDecorator();
|
.asDecorator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package dd.inst.datastax.cassandra;
|
package dd.inst.datastax.cassandra;
|
||||||
|
|
||||||
import static dd.trace.ClassLoaderMatcher.classLoaderHasClasses;
|
import static dd.trace.ClassLoaderMatcher.classLoaderHasClasses;
|
||||||
import static dd.trace.ExceptionHandlers.defaultExceptionHandler;
|
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.*;
|
import static net.bytebuddy.matcher.ElementMatchers.*;
|
||||||
|
|
||||||
import com.datastax.driver.core.Session;
|
import com.datastax.driver.core.Session;
|
||||||
import com.google.auto.service.AutoService;
|
import com.google.auto.service.AutoService;
|
||||||
|
import dd.trace.DDAdvice;
|
||||||
import dd.trace.Instrumenter;
|
import dd.trace.Instrumenter;
|
||||||
import io.opentracing.Tracer;
|
import io.opentracing.Tracer;
|
||||||
import io.opentracing.util.GlobalTracer;
|
import io.opentracing.util.GlobalTracer;
|
||||||
|
@ -36,11 +36,10 @@ public class CassandraClientInstrumentation implements Instrumenter {
|
||||||
"com.google.common.util.concurrent.Futures",
|
"com.google.common.util.concurrent.Futures",
|
||||||
"com.google.common.util.concurrent.ListenableFuture"))
|
"com.google.common.util.concurrent.ListenableFuture"))
|
||||||
.transform(
|
.transform(
|
||||||
new AgentBuilder.Transformer.ForAdvice()
|
DDAdvice.create()
|
||||||
.advice(
|
.advice(
|
||||||
isMethod().and(isPrivate()).and(named("newSession")).and(takesArguments(0)),
|
isMethod().and(isPrivate()).and(named("newSession")).and(takesArguments(0)),
|
||||||
CassandraClientAdvice.class.getName())
|
CassandraClientAdvice.class.getName()))
|
||||||
.withExceptionHandler(defaultExceptionHandler()))
|
|
||||||
.asDecorator();
|
.asDecorator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package dd.inst.jms1;
|
||||||
|
|
||||||
import static com.datadoghq.agent.integration.JmsUtil.toResourceName;
|
import static com.datadoghq.agent.integration.JmsUtil.toResourceName;
|
||||||
import static dd.trace.ClassLoaderMatcher.classLoaderHasClasses;
|
import static dd.trace.ClassLoaderMatcher.classLoaderHasClasses;
|
||||||
import static dd.trace.ExceptionHandlers.defaultExceptionHandler;
|
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
||||||
|
@ -13,6 +12,7 @@ import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
|
||||||
import com.datadoghq.agent.integration.MessagePropertyTextMap;
|
import com.datadoghq.agent.integration.MessagePropertyTextMap;
|
||||||
import com.datadoghq.trace.DDTags;
|
import com.datadoghq.trace.DDTags;
|
||||||
import com.google.auto.service.AutoService;
|
import com.google.auto.service.AutoService;
|
||||||
|
import dd.trace.DDAdvice;
|
||||||
import dd.trace.Instrumenter;
|
import dd.trace.Instrumenter;
|
||||||
import io.opentracing.ActiveSpan;
|
import io.opentracing.ActiveSpan;
|
||||||
import io.opentracing.SpanContext;
|
import io.opentracing.SpanContext;
|
||||||
|
@ -36,14 +36,13 @@ public final class JMS1MessageConsumerInstrumentation implements Instrumenter {
|
||||||
not(isInterface()).and(hasSuperType(named("javax.jms.MessageConsumer"))),
|
not(isInterface()).and(hasSuperType(named("javax.jms.MessageConsumer"))),
|
||||||
not(classLoaderHasClasses("javax.jms.JMSContext", "javax.jms.CompletionListener")))
|
not(classLoaderHasClasses("javax.jms.JMSContext", "javax.jms.CompletionListener")))
|
||||||
.transform(
|
.transform(
|
||||||
new AgentBuilder.Transformer.ForAdvice()
|
DDAdvice.create()
|
||||||
.advice(
|
.advice(
|
||||||
named("receive").and(takesArguments(0)).and(isPublic()),
|
named("receive").and(takesArguments(0)).and(isPublic()),
|
||||||
ConsumerAdvice.class.getName())
|
ConsumerAdvice.class.getName())
|
||||||
.advice(
|
.advice(
|
||||||
named("receiveNoWait").and(takesArguments(0)).and(isPublic()),
|
named("receiveNoWait").and(takesArguments(0)).and(isPublic()),
|
||||||
ConsumerAdvice.class.getName())
|
ConsumerAdvice.class.getName()))
|
||||||
.withExceptionHandler(defaultExceptionHandler()))
|
|
||||||
.asDecorator();
|
.asDecorator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package dd.inst.jms1;
|
||||||
|
|
||||||
import static com.datadoghq.agent.integration.JmsUtil.toResourceName;
|
import static com.datadoghq.agent.integration.JmsUtil.toResourceName;
|
||||||
import static dd.trace.ClassLoaderMatcher.classLoaderHasClasses;
|
import static dd.trace.ClassLoaderMatcher.classLoaderHasClasses;
|
||||||
import static dd.trace.ExceptionHandlers.defaultExceptionHandler;
|
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
||||||
|
@ -13,6 +12,7 @@ import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
|
||||||
import com.datadoghq.agent.integration.MessagePropertyTextMap;
|
import com.datadoghq.agent.integration.MessagePropertyTextMap;
|
||||||
import com.datadoghq.trace.DDTags;
|
import com.datadoghq.trace.DDTags;
|
||||||
import com.google.auto.service.AutoService;
|
import com.google.auto.service.AutoService;
|
||||||
|
import dd.trace.DDAdvice;
|
||||||
import dd.trace.Instrumenter;
|
import dd.trace.Instrumenter;
|
||||||
import io.opentracing.ActiveSpan;
|
import io.opentracing.ActiveSpan;
|
||||||
import io.opentracing.SpanContext;
|
import io.opentracing.SpanContext;
|
||||||
|
@ -35,13 +35,12 @@ public final class JMS1MessageListenerInstrumentation implements Instrumenter {
|
||||||
not(isInterface()).and(hasSuperType(named("javax.jms.MessageListener"))),
|
not(isInterface()).and(hasSuperType(named("javax.jms.MessageListener"))),
|
||||||
not(classLoaderHasClasses("javax.jms.JMSContext", "javax.jms.CompletionListener")))
|
not(classLoaderHasClasses("javax.jms.JMSContext", "javax.jms.CompletionListener")))
|
||||||
.transform(
|
.transform(
|
||||||
new AgentBuilder.Transformer.ForAdvice()
|
DDAdvice.create()
|
||||||
.advice(
|
.advice(
|
||||||
named("onMessage")
|
named("onMessage")
|
||||||
.and(takesArgument(0, named("javax.jms.Message")))
|
.and(takesArgument(0, named("javax.jms.Message")))
|
||||||
.and(isPublic()),
|
.and(isPublic()),
|
||||||
MessageListenerAdvice.class.getName())
|
MessageListenerAdvice.class.getName()))
|
||||||
.withExceptionHandler(defaultExceptionHandler()))
|
|
||||||
.asDecorator();
|
.asDecorator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package dd.inst.jms1;
|
||||||
|
|
||||||
import static com.datadoghq.agent.integration.JmsUtil.toResourceName;
|
import static com.datadoghq.agent.integration.JmsUtil.toResourceName;
|
||||||
import static dd.trace.ClassLoaderMatcher.classLoaderHasClasses;
|
import static dd.trace.ClassLoaderMatcher.classLoaderHasClasses;
|
||||||
import static dd.trace.ExceptionHandlers.defaultExceptionHandler;
|
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
||||||
|
@ -13,6 +12,7 @@ import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
|
||||||
import com.datadoghq.agent.integration.MessagePropertyTextMap;
|
import com.datadoghq.agent.integration.MessagePropertyTextMap;
|
||||||
import com.datadoghq.trace.DDTags;
|
import com.datadoghq.trace.DDTags;
|
||||||
import com.google.auto.service.AutoService;
|
import com.google.auto.service.AutoService;
|
||||||
|
import dd.trace.DDAdvice;
|
||||||
import dd.trace.Instrumenter;
|
import dd.trace.Instrumenter;
|
||||||
import io.opentracing.ActiveSpan;
|
import io.opentracing.ActiveSpan;
|
||||||
import io.opentracing.propagation.Format;
|
import io.opentracing.propagation.Format;
|
||||||
|
@ -36,7 +36,7 @@ public final class JMS1MessageProducerInstrumentation implements Instrumenter {
|
||||||
not(isInterface()).and(hasSuperType(named("javax.jms.MessageProducer"))),
|
not(isInterface()).and(hasSuperType(named("javax.jms.MessageProducer"))),
|
||||||
not(classLoaderHasClasses("javax.jms.JMSContext", "javax.jms.CompletionListener")))
|
not(classLoaderHasClasses("javax.jms.JMSContext", "javax.jms.CompletionListener")))
|
||||||
.transform(
|
.transform(
|
||||||
new AgentBuilder.Transformer.ForAdvice()
|
DDAdvice.create()
|
||||||
.advice(
|
.advice(
|
||||||
named("send").and(takesArgument(0, named("javax.jms.Message"))).and(isPublic()),
|
named("send").and(takesArgument(0, named("javax.jms.Message"))).and(isPublic()),
|
||||||
ProducerAdvice.class.getName())
|
ProducerAdvice.class.getName())
|
||||||
|
@ -45,8 +45,7 @@ public final class JMS1MessageProducerInstrumentation implements Instrumenter {
|
||||||
.and(takesArgument(0, named("javax.jms.Destination")))
|
.and(takesArgument(0, named("javax.jms.Destination")))
|
||||||
.and(takesArgument(1, named("javax.jms.Message")))
|
.and(takesArgument(1, named("javax.jms.Message")))
|
||||||
.and(isPublic()),
|
.and(isPublic()),
|
||||||
ProducerWithDestinationAdvice.class.getName())
|
ProducerWithDestinationAdvice.class.getName()))
|
||||||
.withExceptionHandler(defaultExceptionHandler()))
|
|
||||||
.asDecorator();
|
.asDecorator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package dd.inst.jms2;
|
||||||
|
|
||||||
import static com.datadoghq.agent.integration.JmsUtil.toResourceName;
|
import static com.datadoghq.agent.integration.JmsUtil.toResourceName;
|
||||||
import static dd.trace.ClassLoaderMatcher.classLoaderHasClasses;
|
import static dd.trace.ClassLoaderMatcher.classLoaderHasClasses;
|
||||||
import static dd.trace.ExceptionHandlers.defaultExceptionHandler;
|
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
||||||
|
@ -13,6 +12,7 @@ import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
|
||||||
import com.datadoghq.agent.integration.MessagePropertyTextMap;
|
import com.datadoghq.agent.integration.MessagePropertyTextMap;
|
||||||
import com.datadoghq.trace.DDTags;
|
import com.datadoghq.trace.DDTags;
|
||||||
import com.google.auto.service.AutoService;
|
import com.google.auto.service.AutoService;
|
||||||
|
import dd.trace.DDAdvice;
|
||||||
import dd.trace.Instrumenter;
|
import dd.trace.Instrumenter;
|
||||||
import io.opentracing.ActiveSpan;
|
import io.opentracing.ActiveSpan;
|
||||||
import io.opentracing.SpanContext;
|
import io.opentracing.SpanContext;
|
||||||
|
@ -36,14 +36,13 @@ public final class JMS2MessageConsumerInstrumentation implements Instrumenter {
|
||||||
not(isInterface()).and(hasSuperType(named("javax.jms.MessageConsumer"))),
|
not(isInterface()).and(hasSuperType(named("javax.jms.MessageConsumer"))),
|
||||||
classLoaderHasClasses("javax.jms.JMSContext", "javax.jms.CompletionListener"))
|
classLoaderHasClasses("javax.jms.JMSContext", "javax.jms.CompletionListener"))
|
||||||
.transform(
|
.transform(
|
||||||
new AgentBuilder.Transformer.ForAdvice()
|
DDAdvice.create()
|
||||||
.advice(
|
.advice(
|
||||||
named("receive").and(takesArguments(0)).and(isPublic()),
|
named("receive").and(takesArguments(0)).and(isPublic()),
|
||||||
ConsumerAdvice.class.getName())
|
ConsumerAdvice.class.getName())
|
||||||
.advice(
|
.advice(
|
||||||
named("receiveNoWait").and(takesArguments(0)).and(isPublic()),
|
named("receiveNoWait").and(takesArguments(0)).and(isPublic()),
|
||||||
ConsumerAdvice.class.getName())
|
ConsumerAdvice.class.getName()))
|
||||||
.withExceptionHandler(defaultExceptionHandler()))
|
|
||||||
.asDecorator();
|
.asDecorator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package dd.inst.jms2;
|
||||||
|
|
||||||
import static com.datadoghq.agent.integration.JmsUtil.toResourceName;
|
import static com.datadoghq.agent.integration.JmsUtil.toResourceName;
|
||||||
import static dd.trace.ClassLoaderMatcher.classLoaderHasClasses;
|
import static dd.trace.ClassLoaderMatcher.classLoaderHasClasses;
|
||||||
import static dd.trace.ExceptionHandlers.defaultExceptionHandler;
|
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
||||||
|
@ -13,6 +12,7 @@ import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
|
||||||
import com.datadoghq.agent.integration.MessagePropertyTextMap;
|
import com.datadoghq.agent.integration.MessagePropertyTextMap;
|
||||||
import com.datadoghq.trace.DDTags;
|
import com.datadoghq.trace.DDTags;
|
||||||
import com.google.auto.service.AutoService;
|
import com.google.auto.service.AutoService;
|
||||||
|
import dd.trace.DDAdvice;
|
||||||
import dd.trace.Instrumenter;
|
import dd.trace.Instrumenter;
|
||||||
import io.opentracing.ActiveSpan;
|
import io.opentracing.ActiveSpan;
|
||||||
import io.opentracing.SpanContext;
|
import io.opentracing.SpanContext;
|
||||||
|
@ -35,13 +35,12 @@ public final class JMS2MessageListenerInstrumentation implements Instrumenter {
|
||||||
not(isInterface()).and(hasSuperType(named("javax.jms.MessageListener"))),
|
not(isInterface()).and(hasSuperType(named("javax.jms.MessageListener"))),
|
||||||
classLoaderHasClasses("javax.jms.JMSContext", "javax.jms.CompletionListener"))
|
classLoaderHasClasses("javax.jms.JMSContext", "javax.jms.CompletionListener"))
|
||||||
.transform(
|
.transform(
|
||||||
new AgentBuilder.Transformer.ForAdvice()
|
DDAdvice.create()
|
||||||
.advice(
|
.advice(
|
||||||
named("onMessage")
|
named("onMessage")
|
||||||
.and(takesArgument(0, named("javax.jms.Message")))
|
.and(takesArgument(0, named("javax.jms.Message")))
|
||||||
.and(isPublic()),
|
.and(isPublic()),
|
||||||
MessageListenerAdvice.class.getName())
|
MessageListenerAdvice.class.getName()))
|
||||||
.withExceptionHandler(defaultExceptionHandler()))
|
|
||||||
.asDecorator();
|
.asDecorator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ package dd.inst.jms2;
|
||||||
|
|
||||||
import static com.datadoghq.agent.integration.JmsUtil.toResourceName;
|
import static com.datadoghq.agent.integration.JmsUtil.toResourceName;
|
||||||
import static dd.trace.ClassLoaderMatcher.classLoaderHasClasses;
|
import static dd.trace.ClassLoaderMatcher.classLoaderHasClasses;
|
||||||
import static dd.trace.ExceptionHandlers.defaultExceptionHandler;
|
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
||||||
|
@ -13,6 +12,7 @@ import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
|
||||||
import com.datadoghq.agent.integration.MessagePropertyTextMap;
|
import com.datadoghq.agent.integration.MessagePropertyTextMap;
|
||||||
import com.datadoghq.trace.DDTags;
|
import com.datadoghq.trace.DDTags;
|
||||||
import com.google.auto.service.AutoService;
|
import com.google.auto.service.AutoService;
|
||||||
|
import dd.trace.DDAdvice;
|
||||||
import dd.trace.Instrumenter;
|
import dd.trace.Instrumenter;
|
||||||
import io.opentracing.ActiveSpan;
|
import io.opentracing.ActiveSpan;
|
||||||
import io.opentracing.propagation.Format;
|
import io.opentracing.propagation.Format;
|
||||||
|
@ -36,7 +36,7 @@ public final class JMS2MessageProducerInstrumentation implements Instrumenter {
|
||||||
not(isInterface()).and(hasSuperType(named("javax.jms.MessageProducer"))),
|
not(isInterface()).and(hasSuperType(named("javax.jms.MessageProducer"))),
|
||||||
classLoaderHasClasses("javax.jms.JMSContext", "javax.jms.CompletionListener"))
|
classLoaderHasClasses("javax.jms.JMSContext", "javax.jms.CompletionListener"))
|
||||||
.transform(
|
.transform(
|
||||||
new AgentBuilder.Transformer.ForAdvice()
|
DDAdvice.create()
|
||||||
.advice(
|
.advice(
|
||||||
named("send").and(takesArgument(0, named("javax.jms.Message"))).and(isPublic()),
|
named("send").and(takesArgument(0, named("javax.jms.Message"))).and(isPublic()),
|
||||||
ProducerAdvice.class.getName())
|
ProducerAdvice.class.getName())
|
||||||
|
@ -45,8 +45,7 @@ public final class JMS2MessageProducerInstrumentation implements Instrumenter {
|
||||||
.and(takesArgument(0, named("javax.jms.Destination")))
|
.and(takesArgument(0, named("javax.jms.Destination")))
|
||||||
.and(takesArgument(1, named("javax.jms.Message")))
|
.and(takesArgument(1, named("javax.jms.Message")))
|
||||||
.and(isPublic()),
|
.and(isPublic()),
|
||||||
ProducerWithDestinationAdvice.class.getName())
|
ProducerWithDestinationAdvice.class.getName()))
|
||||||
.withExceptionHandler(defaultExceptionHandler()))
|
|
||||||
.asDecorator();
|
.asDecorator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package dd.inst.mongo;
|
package dd.inst.mongo;
|
||||||
|
|
||||||
import static dd.trace.ExceptionHandlers.defaultExceptionHandler;
|
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.*;
|
import static net.bytebuddy.matcher.ElementMatchers.*;
|
||||||
|
|
||||||
import com.datadoghq.agent.integration.DDTracingCommandListener;
|
import com.datadoghq.agent.integration.DDTracingCommandListener;
|
||||||
import com.google.auto.service.AutoService;
|
import com.google.auto.service.AutoService;
|
||||||
import com.mongodb.MongoClientOptions;
|
import com.mongodb.MongoClientOptions;
|
||||||
|
import dd.trace.DDAdvice;
|
||||||
import dd.trace.Instrumenter;
|
import dd.trace.Instrumenter;
|
||||||
import io.opentracing.util.GlobalTracer;
|
import io.opentracing.util.GlobalTracer;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
|
@ -33,11 +33,10 @@ public final class MongoClientInstrumentation implements Instrumenter {
|
||||||
null,
|
null,
|
||||||
new TypeDescription.Generic[] {}))))))
|
new TypeDescription.Generic[] {}))))))
|
||||||
.transform(
|
.transform(
|
||||||
new AgentBuilder.Transformer.ForAdvice()
|
DDAdvice.create()
|
||||||
.advice(
|
.advice(
|
||||||
isMethod().and(isPublic()).and(named("build")).and(takesArguments(0)),
|
isMethod().and(isPublic()).and(named("build")).and(takesArguments(0)),
|
||||||
MongoClientAdvice.class.getName())
|
MongoClientAdvice.class.getName()))
|
||||||
.withExceptionHandler(defaultExceptionHandler()))
|
|
||||||
.asDecorator();
|
.asDecorator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package dd.inst.mongo;
|
package dd.inst.mongo;
|
||||||
|
|
||||||
import static dd.trace.ExceptionHandlers.defaultExceptionHandler;
|
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.*;
|
import static net.bytebuddy.matcher.ElementMatchers.*;
|
||||||
|
|
||||||
import com.datadoghq.agent.integration.DDTracingCommandListener;
|
import com.datadoghq.agent.integration.DDTracingCommandListener;
|
||||||
import com.google.auto.service.AutoService;
|
import com.google.auto.service.AutoService;
|
||||||
import com.mongodb.async.client.MongoClientSettings;
|
import com.mongodb.async.client.MongoClientSettings;
|
||||||
|
import dd.trace.DDAdvice;
|
||||||
import dd.trace.Instrumenter;
|
import dd.trace.Instrumenter;
|
||||||
import io.opentracing.util.GlobalTracer;
|
import io.opentracing.util.GlobalTracer;
|
||||||
import java.lang.reflect.Modifier;
|
import java.lang.reflect.Modifier;
|
||||||
|
@ -33,11 +33,10 @@ public final class MongoAsyncClientInstrumentation implements Instrumenter {
|
||||||
null,
|
null,
|
||||||
new TypeDescription.Generic[] {}))))))
|
new TypeDescription.Generic[] {}))))))
|
||||||
.transform(
|
.transform(
|
||||||
new AgentBuilder.Transformer.ForAdvice()
|
DDAdvice.create()
|
||||||
.advice(
|
.advice(
|
||||||
isMethod().and(isPublic()).and(named("build")).and(takesArguments(0)),
|
isMethod().and(isPublic()).and(named("build")).and(takesArguments(0)),
|
||||||
MongoAsyncClientAdvice.class.getName())
|
MongoAsyncClientAdvice.class.getName()))
|
||||||
.withExceptionHandler(defaultExceptionHandler()))
|
|
||||||
.asDecorator();
|
.asDecorator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package dd.inst.servlet2;
|
package dd.inst.servlet2;
|
||||||
|
|
||||||
import static dd.trace.ClassLoaderMatcher.classLoaderHasClasses;
|
import static dd.trace.ClassLoaderMatcher.classLoaderHasClasses;
|
||||||
import static dd.trace.ExceptionHandlers.defaultExceptionHandler;
|
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isProtected;
|
import static net.bytebuddy.matcher.ElementMatchers.isProtected;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.not;
|
import static net.bytebuddy.matcher.ElementMatchers.not;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
|
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
|
||||||
|
|
||||||
import com.google.auto.service.AutoService;
|
import com.google.auto.service.AutoService;
|
||||||
|
import dd.trace.DDAdvice;
|
||||||
import dd.trace.Instrumenter;
|
import dd.trace.Instrumenter;
|
||||||
import io.opentracing.ActiveSpan;
|
import io.opentracing.ActiveSpan;
|
||||||
import io.opentracing.SpanContext;
|
import io.opentracing.SpanContext;
|
||||||
|
@ -36,14 +36,13 @@ public final class HttpServlet2Instrumentation implements Instrumenter {
|
||||||
classLoaderHasClasses(
|
classLoaderHasClasses(
|
||||||
"javax.servlet.ServletContextEvent", "javax.servlet.FilterChain")))
|
"javax.servlet.ServletContextEvent", "javax.servlet.FilterChain")))
|
||||||
.transform(
|
.transform(
|
||||||
new AgentBuilder.Transformer.ForAdvice()
|
DDAdvice.create()
|
||||||
.advice(
|
.advice(
|
||||||
named("service")
|
named("service")
|
||||||
.and(takesArgument(0, named("javax.servlet.http.HttpServletRequest")))
|
.and(takesArgument(0, named("javax.servlet.http.HttpServletRequest")))
|
||||||
.and(takesArgument(1, named("javax.servlet.http.HttpServletResponse")))
|
.and(takesArgument(1, named("javax.servlet.http.HttpServletResponse")))
|
||||||
.and(isProtected()),
|
.and(isProtected()),
|
||||||
HttpServlet2Advice.class.getName())
|
HttpServlet2Advice.class.getName()))
|
||||||
.withExceptionHandler(defaultExceptionHandler()))
|
|
||||||
.asDecorator();
|
.asDecorator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package dd.inst.servlet3;
|
package dd.inst.servlet3;
|
||||||
|
|
||||||
import static dd.trace.ClassLoaderMatcher.classLoaderHasClasses;
|
import static dd.trace.ClassLoaderMatcher.classLoaderHasClasses;
|
||||||
import static dd.trace.ExceptionHandlers.defaultExceptionHandler;
|
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isProtected;
|
import static net.bytebuddy.matcher.ElementMatchers.isProtected;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
|
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
|
||||||
|
|
||||||
import com.google.auto.service.AutoService;
|
import com.google.auto.service.AutoService;
|
||||||
|
import dd.trace.DDAdvice;
|
||||||
import dd.trace.Instrumenter;
|
import dd.trace.Instrumenter;
|
||||||
import io.opentracing.ActiveSpan;
|
import io.opentracing.ActiveSpan;
|
||||||
import io.opentracing.SpanContext;
|
import io.opentracing.SpanContext;
|
||||||
|
@ -36,14 +36,13 @@ public final class HttpServlet3Instrumentation implements Instrumenter {
|
||||||
named("javax.servlet.http.HttpServlet"),
|
named("javax.servlet.http.HttpServlet"),
|
||||||
classLoaderHasClasses("javax.servlet.AsyncEvent", "javax.servlet.AsyncListener"))
|
classLoaderHasClasses("javax.servlet.AsyncEvent", "javax.servlet.AsyncListener"))
|
||||||
.transform(
|
.transform(
|
||||||
new AgentBuilder.Transformer.ForAdvice()
|
DDAdvice.create()
|
||||||
.advice(
|
.advice(
|
||||||
named("service")
|
named("service")
|
||||||
.and(takesArgument(0, named("javax.servlet.http.HttpServletRequest")))
|
.and(takesArgument(0, named("javax.servlet.http.HttpServletRequest")))
|
||||||
.and(takesArgument(1, named("javax.servlet.http.HttpServletResponse")))
|
.and(takesArgument(1, named("javax.servlet.http.HttpServletResponse")))
|
||||||
.and(isProtected()),
|
.and(isProtected()),
|
||||||
HttpServlet3Advice.class.getName())
|
HttpServlet3Advice.class.getName()))
|
||||||
.withExceptionHandler(defaultExceptionHandler()))
|
|
||||||
.asDecorator();
|
.asDecorator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package dd.inst.springweb;
|
package dd.inst.springweb;
|
||||||
|
|
||||||
import static dd.trace.ClassLoaderMatcher.classLoaderHasClassWithField;
|
import static dd.trace.ClassLoaderMatcher.classLoaderHasClassWithField;
|
||||||
import static dd.trace.ExceptionHandlers.defaultExceptionHandler;
|
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
|
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
|
||||||
|
@ -13,6 +12,7 @@ import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
|
||||||
|
|
||||||
import com.datadoghq.trace.DDTags;
|
import com.datadoghq.trace.DDTags;
|
||||||
import com.google.auto.service.AutoService;
|
import com.google.auto.service.AutoService;
|
||||||
|
import dd.trace.DDAdvice;
|
||||||
import dd.trace.Instrumenter;
|
import dd.trace.Instrumenter;
|
||||||
import io.opentracing.ActiveSpan;
|
import io.opentracing.ActiveSpan;
|
||||||
import io.opentracing.util.GlobalTracer;
|
import io.opentracing.util.GlobalTracer;
|
||||||
|
@ -38,14 +38,13 @@ public final class SpringWebInstrumentation implements Instrumenter {
|
||||||
"org.springframework.web.servlet.HandlerMapping",
|
"org.springframework.web.servlet.HandlerMapping",
|
||||||
"BEST_MATCHING_PATTERN_ATTRIBUTE"))
|
"BEST_MATCHING_PATTERN_ATTRIBUTE"))
|
||||||
.transform(
|
.transform(
|
||||||
new AgentBuilder.Transformer.ForAdvice()
|
DDAdvice.create()
|
||||||
.advice(
|
.advice(
|
||||||
isMethod()
|
isMethod()
|
||||||
.and(isPublic())
|
.and(isPublic())
|
||||||
.and(nameStartsWith("handle"))
|
.and(nameStartsWith("handle"))
|
||||||
.and(takesArgument(0, named("javax.servlet.http.HttpServletRequest"))),
|
.and(takesArgument(0, named("javax.servlet.http.HttpServletRequest"))),
|
||||||
SpringWebAdvice.class.getName())
|
SpringWebAdvice.class.getName()))
|
||||||
.withExceptionHandler(defaultExceptionHandler()))
|
|
||||||
.asDecorator();
|
.asDecorator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package com.datadoghq.agent.instrumentation.annotation;
|
package com.datadoghq.agent.instrumentation.annotation;
|
||||||
|
|
||||||
import static dd.trace.ExceptionHandlers.defaultExceptionHandler;
|
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.declaresMethod;
|
import static net.bytebuddy.matcher.ElementMatchers.declaresMethod;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isAnnotatedWith;
|
import static net.bytebuddy.matcher.ElementMatchers.isAnnotatedWith;
|
||||||
|
|
||||||
import com.datadoghq.trace.Trace;
|
import com.datadoghq.trace.Trace;
|
||||||
import com.google.auto.service.AutoService;
|
import com.google.auto.service.AutoService;
|
||||||
|
import dd.trace.DDAdvice;
|
||||||
import dd.trace.Instrumenter;
|
import dd.trace.Instrumenter;
|
||||||
import io.opentracing.ActiveSpan;
|
import io.opentracing.ActiveSpan;
|
||||||
import io.opentracing.tag.Tags;
|
import io.opentracing.tag.Tags;
|
||||||
|
@ -28,9 +28,7 @@ public final class TraceAnnotationInstrumentation implements Instrumenter {
|
||||||
return agentBuilder
|
return agentBuilder
|
||||||
.type(hasSuperType(declaresMethod(isAnnotatedWith(Trace.class))))
|
.type(hasSuperType(declaresMethod(isAnnotatedWith(Trace.class))))
|
||||||
.transform(
|
.transform(
|
||||||
new AgentBuilder.Transformer.ForAdvice()
|
DDAdvice.create().advice(isAnnotatedWith(Trace.class), TraceAdvice.class.getName()))
|
||||||
.advice(isAnnotatedWith(Trace.class), TraceAdvice.class.getName())
|
|
||||||
.withExceptionHandler(defaultExceptionHandler()))
|
|
||||||
.asDecorator();
|
.asDecorator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.datadoghq.agent.instrumentation.jdbc;
|
package com.datadoghq.agent.instrumentation.jdbc;
|
||||||
|
|
||||||
import static dd.trace.ExceptionHandlers.defaultExceptionHandler;
|
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.nameStartsWith;
|
import static net.bytebuddy.matcher.ElementMatchers.nameStartsWith;
|
||||||
|
@ -10,6 +9,7 @@ import static net.bytebuddy.matcher.ElementMatchers.returns;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
|
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
|
||||||
|
|
||||||
import com.google.auto.service.AutoService;
|
import com.google.auto.service.AutoService;
|
||||||
|
import dd.trace.DDAdvice;
|
||||||
import dd.trace.Instrumenter;
|
import dd.trace.Instrumenter;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
|
@ -27,13 +27,12 @@ public final class ConnectionInstrumentation implements Instrumenter {
|
||||||
return agentBuilder
|
return agentBuilder
|
||||||
.type(not(isInterface()).and(hasSuperType(named(Connection.class.getName()))))
|
.type(not(isInterface()).and(hasSuperType(named(Connection.class.getName()))))
|
||||||
.transform(
|
.transform(
|
||||||
new AgentBuilder.Transformer.ForAdvice()
|
DDAdvice.create()
|
||||||
.advice(
|
.advice(
|
||||||
nameStartsWith("prepare")
|
nameStartsWith("prepare")
|
||||||
.and(takesArgument(0, String.class))
|
.and(takesArgument(0, String.class))
|
||||||
.and(returns(PreparedStatement.class)),
|
.and(returns(PreparedStatement.class)),
|
||||||
ConnectionAdvice.class.getName())
|
ConnectionAdvice.class.getName()))
|
||||||
.withExceptionHandler(defaultExceptionHandler()))
|
|
||||||
.asDecorator();
|
.asDecorator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.datadoghq.agent.instrumentation.jdbc;
|
package com.datadoghq.agent.instrumentation.jdbc;
|
||||||
|
|
||||||
import static dd.trace.ExceptionHandlers.defaultExceptionHandler;
|
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.named;
|
import static net.bytebuddy.matcher.ElementMatchers.named;
|
||||||
|
@ -8,6 +7,7 @@ import static net.bytebuddy.matcher.ElementMatchers.not;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
|
import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
|
||||||
|
|
||||||
import com.google.auto.service.AutoService;
|
import com.google.auto.service.AutoService;
|
||||||
|
import dd.trace.DDAdvice;
|
||||||
import dd.trace.Instrumenter;
|
import dd.trace.Instrumenter;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.Driver;
|
import java.sql.Driver;
|
||||||
|
@ -27,11 +27,10 @@ public final class DriverInstrumentation implements Instrumenter {
|
||||||
return agentBuilder
|
return agentBuilder
|
||||||
.type(not(isInterface()).and(hasSuperType(named(Driver.class.getName()))))
|
.type(not(isInterface()).and(hasSuperType(named(Driver.class.getName()))))
|
||||||
.transform(
|
.transform(
|
||||||
new AgentBuilder.Transformer.ForAdvice()
|
DDAdvice.create()
|
||||||
.advice(
|
.advice(
|
||||||
named("connect").and(takesArguments(String.class, Properties.class)),
|
named("connect").and(takesArguments(String.class, Properties.class)),
|
||||||
DriverAdvice.class.getName())
|
DriverAdvice.class.getName()))
|
||||||
.withExceptionHandler(defaultExceptionHandler()))
|
|
||||||
.asDecorator();
|
.asDecorator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.datadoghq.agent.instrumentation.jdbc;
|
package com.datadoghq.agent.instrumentation.jdbc;
|
||||||
|
|
||||||
import static dd.trace.ExceptionHandlers.defaultExceptionHandler;
|
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
||||||
|
@ -11,6 +10,7 @@ import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
|
||||||
|
|
||||||
import com.datadoghq.trace.DDTags;
|
import com.datadoghq.trace.DDTags;
|
||||||
import com.google.auto.service.AutoService;
|
import com.google.auto.service.AutoService;
|
||||||
|
import dd.trace.DDAdvice;
|
||||||
import dd.trace.Instrumenter;
|
import dd.trace.Instrumenter;
|
||||||
import io.opentracing.ActiveSpan;
|
import io.opentracing.ActiveSpan;
|
||||||
import io.opentracing.NoopActiveSpanSource;
|
import io.opentracing.NoopActiveSpanSource;
|
||||||
|
@ -31,11 +31,10 @@ public final class PreparedStatementInstrumentation implements Instrumenter {
|
||||||
return agentBuilder
|
return agentBuilder
|
||||||
.type(not(isInterface()).and(hasSuperType(named(PreparedStatement.class.getName()))))
|
.type(not(isInterface()).and(hasSuperType(named(PreparedStatement.class.getName()))))
|
||||||
.transform(
|
.transform(
|
||||||
new AgentBuilder.Transformer.ForAdvice()
|
DDAdvice.create()
|
||||||
.advice(
|
.advice(
|
||||||
nameStartsWith("execute").and(takesArguments(0)).and(isPublic()),
|
nameStartsWith("execute").and(takesArguments(0)).and(isPublic()),
|
||||||
PreparedStatementAdvice.class.getName())
|
PreparedStatementAdvice.class.getName()))
|
||||||
.withExceptionHandler(defaultExceptionHandler()))
|
|
||||||
.asDecorator();
|
.asDecorator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.datadoghq.agent.instrumentation.jdbc;
|
package com.datadoghq.agent.instrumentation.jdbc;
|
||||||
|
|
||||||
import static dd.trace.ExceptionHandlers.defaultExceptionHandler;
|
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
import static net.bytebuddy.matcher.ElementMatchers.hasSuperType;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
import static net.bytebuddy.matcher.ElementMatchers.isInterface;
|
||||||
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
|
||||||
|
@ -11,6 +10,7 @@ import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
|
||||||
|
|
||||||
import com.datadoghq.trace.DDTags;
|
import com.datadoghq.trace.DDTags;
|
||||||
import com.google.auto.service.AutoService;
|
import com.google.auto.service.AutoService;
|
||||||
|
import dd.trace.DDAdvice;
|
||||||
import dd.trace.Instrumenter;
|
import dd.trace.Instrumenter;
|
||||||
import io.opentracing.ActiveSpan;
|
import io.opentracing.ActiveSpan;
|
||||||
import io.opentracing.NoopActiveSpanSource;
|
import io.opentracing.NoopActiveSpanSource;
|
||||||
|
@ -30,11 +30,10 @@ public final class StatementInstrumentation implements Instrumenter {
|
||||||
return agentBuilder
|
return agentBuilder
|
||||||
.type(not(isInterface()).and(hasSuperType(named(Statement.class.getName()))))
|
.type(not(isInterface()).and(hasSuperType(named(Statement.class.getName()))))
|
||||||
.transform(
|
.transform(
|
||||||
new AgentBuilder.Transformer.ForAdvice()
|
DDAdvice.create()
|
||||||
.advice(
|
.advice(
|
||||||
nameStartsWith("execute").and(takesArgument(0, String.class)).and(isPublic()),
|
nameStartsWith("execute").and(takesArgument(0, String.class)).and(isPublic()),
|
||||||
StatementAdvice.class.getName())
|
StatementAdvice.class.getName()))
|
||||||
.withExceptionHandler(defaultExceptionHandler()))
|
|
||||||
.asDecorator();
|
.asDecorator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
package dd.trace;
|
||||||
|
|
||||||
|
import net.bytebuddy.agent.builder.AgentBuilder;
|
||||||
|
|
||||||
|
/** A bytebuddy advice builder with default DataDog settings. */
|
||||||
|
public class DDAdvice extends AgentBuilder.Transformer.ForAdvice {
|
||||||
|
public static AgentBuilder.Transformer.ForAdvice create() {
|
||||||
|
return new DDAdvice()
|
||||||
|
.withExceptionHandler(ExceptionHandlers.defaultExceptionHandler());
|
||||||
|
}
|
||||||
|
|
||||||
|
private DDAdvice() {}
|
||||||
|
}
|
Loading…
Reference in New Issue