GeezerVison is showing github.com — Group `javax.jms` instrumentations under a single module by mcculls · Pull Request #8154 · DataDog/dd-trace-java
Group javax.jms instrumentations under a single module
#8154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and
privacy statement . We’ll occasionally send you account related emails.
Already on GitHub?
Sign in
to your account
Uh oh!
There was an error while loading. Please reload this page.
Show file tree
Hide file tree
Changes from all commits
Commits
File filter
Filter by extension
.java
(6)
All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Hide whitespace
Diff view
Hide whitespace
There are no files selected for viewing
Original file line number
Diff line number
Diff line change
Expand Up
@@ -19,31 +19,22 @@
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
import com.google.auto.service.AutoService;
import datadog.trace.agent.tooling.Instrumenter;
import datadog.trace.agent.tooling.InstrumenterModule;
import datadog.trace.bootstrap.CallDepthThreadLocalMap;
import datadog.trace.bootstrap.InstrumentationContext;
import datadog.trace.bootstrap.instrumentation.api.AgentSpan;
import datadog.trace.bootstrap.instrumentation.jms.MessageConsumerState;
import datadog.trace.bootstrap.instrumentation.jms.SessionState;
import java.util.HashMap;
import java.util.Map;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageListener;
import net.bytebuddy.asm.Advice;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.matcher.ElementMatcher;
@AutoService(InstrumenterModule.class)
public final class JMSMessageConsumerInstrumentation extends InstrumenterModule.Tracing
public final class JMSMessageConsumerInstrumentation
implements Instrumenter.ForTypeHierarchy, Instrumenter.HasMethodAdvice {
public JMSMessageConsumerInstrumentation() {
super("jms", "jms-1", "jms-2");
}
@Override
public String hierarchyMarkerType() {
return "javax.jms.MessageConsumer";
Expand All
@@ -54,24 +45,6 @@ public ElementMatcher<TypeDescription> hierarchyMatcher() {
return implementsInterface(named(hierarchyMarkerType()));
}
@Override
public String[] helperClassNames() {
return new String[] {
packageName + ".JMSDecorator",
packageName + ".MessageExtractAdapter",
packageName + ".MessageExtractAdapter$1",
packageName + ".DatadogMessageListener"
};
}
@Override
public Map<String, String> contextStore() {
Map<String, String> contextStore = new HashMap<>(4);
contextStore.put("javax.jms.MessageConsumer", MessageConsumerState.class.getName());
contextStore.put("javax.jms.Message", SessionState.class.getName());
return contextStore;
}
@Override
public void methodAdvice(MethodTransformer transformer) {
transformer.applyAdvice(
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -10,35 +10,26 @@
import static datadog.trace.instrumentation.jms.JMSDecorator.PRODUCER_DECORATE;
import static datadog.trace.instrumentation.jms.JMSDecorator.TIME_IN_QUEUE_ENABLED;
import static datadog.trace.instrumentation.jms.MessageInjectAdapter.SETTER;
import static java.util.Collections.singletonMap;
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
import com.google.auto.service.AutoService;
import datadog.trace.agent.tooling.Instrumenter;
import datadog.trace.agent.tooling.InstrumenterModule;
import datadog.trace.api.Config;
import datadog.trace.bootstrap.CallDepthThreadLocalMap;
import datadog.trace.bootstrap.InstrumentationContext;
import datadog.trace.bootstrap.instrumentation.api.AgentScope;
import datadog.trace.bootstrap.instrumentation.api.AgentSpan;
import datadog.trace.bootstrap.instrumentation.jms.MessageProducerState;
import java.util.Map;
import javax.jms.Destination;
import javax.jms.Message;
import javax.jms.MessageProducer;
import net.bytebuddy.asm.Advice;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.matcher.ElementMatcher;
@AutoService(InstrumenterModule.class)
public final class JMSMessageProducerInstrumentation extends InstrumenterModule.Tracing
public final class JMSMessageProducerInstrumentation
implements Instrumenter.ForTypeHierarchy, Instrumenter.HasMethodAdvice {
public JMSMessageProducerInstrumentation() {
super("jms", "jms-1", "jms-2");
}
@Override
public String hierarchyMarkerType() {
return "javax.jms.MessageProducer";
Expand All
@@ -49,16 +40,6 @@ public ElementMatcher<TypeDescription> hierarchyMatcher() {
return implementsInterface(named(hierarchyMarkerType()));
}
@Override
public String[] helperClassNames() {
return new String[] {packageName + ".JMSDecorator", packageName + ".MessageInjectAdapter"};
}
@Override
public Map<String, String> contextStore() {
return singletonMap("javax.jms.MessageProducer", MessageProducerState.class.getName());
}
@Override
public void methodAdvice(MethodTransformer transformer) {
transformer.applyAdvice(
Expand Down
Original file line number
Diff line number
Diff line change
@@ -0,0 +1,50 @@
package datadog.trace.instrumentation.jms;
import com.google.auto.service.AutoService;
import datadog.trace.agent.tooling.Instrumenter;
import datadog.trace.agent.tooling.InstrumenterModule;
import datadog.trace.bootstrap.instrumentation.jms.MessageConsumerState;
import datadog.trace.bootstrap.instrumentation.jms.MessageProducerState;
import datadog.trace.bootstrap.instrumentation.jms.SessionState;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@AutoService(InstrumenterModule.class)
public class JavaxJmsModule extends InstrumenterModule.Tracing {
public JavaxJmsModule() {
super("jms", "jms-1", "jms-2");
}
@Override
public String[] helperClassNames() {
return new String[] {
packageName + ".JMSDecorator",
packageName + ".MessageExtractAdapter",
packageName + ".MessageExtractAdapter$1",
packageName + ".MessageInjectAdapter",
packageName + ".DatadogMessageListener"
};
}
@Override
public Map<String, String> contextStore() {
Map<String, String> contextStore = new HashMap<>(4);
contextStore.put("javax.jms.MessageConsumer", MessageConsumerState.class.getName());
contextStore.put("javax.jms.MessageProducer", MessageProducerState.class.getName());
contextStore.put("javax.jms.Message", SessionState.class.getName());
contextStore.put("javax.jms.Session", SessionState.class.getName());
return contextStore;
}
@Override
public List<Instrumenter> typeInstrumentations() {
return Arrays.asList(
new JMSMessageConsumerInstrumentation(),
new JMSMessageProducerInstrumentation(),
new MDBMessageConsumerInstrumentation(),
new MessageInstrumentation(),
new SessionInstrumentation());
}
}
Original file line number
Diff line number
Diff line change
Expand Up
@@ -16,9 +16,7 @@
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
import static net.bytebuddy.matcher.ElementMatchers.takesArguments;
import com.google.auto.service.AutoService;
import datadog.trace.agent.tooling.Instrumenter;
import datadog.trace.agent.tooling.InstrumenterModule;
import datadog.trace.bootstrap.CallDepthThreadLocalMap;
import datadog.trace.bootstrap.instrumentation.api.AgentScope;
import datadog.trace.bootstrap.instrumentation.api.AgentSpan;
Expand All
@@ -30,23 +28,9 @@
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.matcher.ElementMatcher;
@AutoService(InstrumenterModule.class)
public final class MDBMessageConsumerInstrumentation extends InstrumenterModule.Tracing
public final class MDBMessageConsumerInstrumentation
implements Instrumenter.ForTypeHierarchy, Instrumenter.HasMethodAdvice {
public MDBMessageConsumerInstrumentation() {
super("jms", "javax-mdb");
Comment thread
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more .
To simplify things, and given we haven't had to turn this off independently, we're now grouping this under the JMS module with the rest of the JMS instrumentation.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
amarziali reacted with thumbs up emoji
}
@Override
public String[] helperClassNames() {
return new String[] {
packageName + ".JMSDecorator",
packageName + ".MessageExtractAdapter",
packageName + ".MessageExtractAdapter$1"
};
}
@Override
public String hierarchyMarkerType() {
return "javax.jms.MessageListener";
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -3,28 +3,20 @@
import static datadog.trace.agent.tooling.bytebuddy.matcher.HierarchyMatchers.implementsInterface;
import static datadog.trace.agent.tooling.bytebuddy.matcher.NameMatchers.nameStartsWith;
import static datadog.trace.agent.tooling.bytebuddy.matcher.NameMatchers.named;
import static java.util.Collections.singletonMap;
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
import static net.bytebuddy.matcher.ElementMatchers.isPublic;
import static net.bytebuddy.matcher.ElementMatchers.takesNoArguments;
import com.google.auto.service.AutoService;
import datadog.trace.agent.tooling.Instrumenter;
import datadog.trace.agent.tooling.InstrumenterModule;
import datadog.trace.bootstrap.InstrumentationContext;
import datadog.trace.bootstrap.instrumentation.jms.SessionState;
import java.util.Map;
import javax.jms.Message;
import net.bytebuddy.asm.Advice;
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.matcher.ElementMatcher;
@AutoService(InstrumenterModule.class)
public class MessageInstrumentation extends InstrumenterModule.Tracing
public class MessageInstrumentation
implements Instrumenter.ForTypeHierarchy, Instrumenter.HasMethodAdvice {
public MessageInstrumentation() {
super("jms", "jms-1", "jms-2");
}
@Override
public String hierarchyMarkerType() {
Expand All
@@ -36,11 +28,6 @@ public ElementMatcher<TypeDescription> hierarchyMatcher() {
return implementsInterface(named(hierarchyMarkerType()));
}
@Override
public Map<String, String> contextStore() {
return singletonMap("javax.jms.Message", SessionState.class.getName());
}
@Override
public void methodAdvice(MethodTransformer transformer) {
transformer.applyAdvice(
Expand Down
Original file line number
Diff line number
Diff line change
Expand Up
@@ -13,17 +13,13 @@
import static net.bytebuddy.matcher.ElementMatchers.takesArgument;
import static net.bytebuddy.matcher.ElementMatchers.takesNoArguments;
import com.google.auto.service.AutoService;
import datadog.trace.agent.tooling.Instrumenter;
import datadog.trace.agent.tooling.InstrumenterModule;
import datadog.trace.api.Config;
import datadog.trace.bootstrap.ContextStore;
import datadog.trace.bootstrap.InstrumentationContext;
import datadog.trace.bootstrap.instrumentation.jms.MessageConsumerState;
import datadog.trace.bootstrap.instrumentation.jms.MessageProducerState;
import datadog.trace.bootstrap.instrumentation.jms.SessionState;
import java.util.HashMap;
import java.util.Map;
import javax.jms.Destination;
import javax.jms.MessageConsumer;
import javax.jms.MessageProducer;
Expand All
@@ -32,12 +28,8 @@
import net.bytebuddy.description.type.TypeDescription;
import net.bytebuddy.matcher.ElementMatcher;
@AutoService(InstrumenterModule.class)
public class SessionInstrumentation extends InstrumenterModule.Tracing
public class SessionInstrumentation
implements Instrumenter.ForTypeHierarchy, Instrumenter.HasMethodAdvice {
public SessionInstrumentation() {
super("jms", "jms-1", "jms-2");
}
@Override
public String hierarchyMarkerType() {
Expand All
@@ -49,20 +41,6 @@ public ElementMatcher<TypeDescription> hierarchyMatcher() {
return implementsInterface(named(hierarchyMarkerType()));
}
@Override
public String[] helperClassNames() {
return new String[] {packageName + ".JMSDecorator"};
}
@Override
public Map<String, String> contextStore() {
Map<String, String> contextStore = new HashMap<>(4);
contextStore.put("javax.jms.MessageConsumer", MessageConsumerState.class.getName());
contextStore.put("javax.jms.MessageProducer", MessageProducerState.class.getName());
contextStore.put("javax.jms.Session", SessionState.class.getName());
return contextStore;
}
@Override
public void methodAdvice(MethodTransformer transformer) {
transformer.applyAdvice(
Expand Down
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.