GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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.

Sign up for GitHub

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

Merged
mcculls merged 1 commit into master from mcculls/javax-jms-module
Jan 6, 2025

Uh oh!

There was an error while loading. Please reload this page.

Merged

Group javax.jms instrumentations under a single module #8154

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
1 commit
Select commit
35d6fa0
Group javax.jms instrumentations under a single module
mcculls Jan 4, 2025
File filter
Filter by extension

Clear filters
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
Diff view

There are no files selected for viewing

29 changes: 1 addition & 28 deletions 29 ...ms/src/main/java/datadog/trace/instrumentation/jms/JMSMessageConsumerInstrumentation.java
Show comments
View file
Open in desktop
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
21 changes: 1 addition & 20 deletions 21 ...ms/src/main/java/datadog/trace/instrumentation/jms/JMSMessageProducerInstrumentation.java
Show comments
View file
Open in desktop
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
50 changes: 50 additions & 0 deletions 50 ...t/instrumentation/jms/src/main/java/datadog/trace/instrumentation/jms/JavaxJmsModule.java
Show comments
View file
Open in desktop
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());
}
}
18 changes: 1 addition & 17 deletions 18 ...ms/src/main/java/datadog/trace/instrumentation/jms/MDBMessageConsumerInstrumentation.java
Show comments
View file
Open in desktop
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

@mcculls mcculls Jan 4, 2025

Copy link
Copy Markdown
Contributor Author

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
All reactions
  • 👍 1 reaction
}

@Override
public String[] helperClassNames() {
return new String[] {
packageName + ".JMSDecorator",
packageName + ".MessageExtractAdapter",
packageName + ".MessageExtractAdapter$1"
};
}

@Override
public String hierarchyMarkerType() {
return "javax.jms.MessageListener";
Expand Down
15 changes: 1 addition & 14 deletions 15 ...mentation/jms/src/main/java/datadog/trace/instrumentation/jms/MessageInstrumentation.java
Show comments
View file
Open in desktop
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
24 changes: 1 addition & 23 deletions 24 ...mentation/jms/src/main/java/datadog/trace/instrumentation/jms/SessionInstrumentation.java
Show comments
View file
Open in desktop
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.