Skip to content

Commit

Permalink
fix thread propagation on late scheduled stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
amarziali committed Nov 27, 2024
1 parent d57ed80 commit 12741f5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
7 changes: 6 additions & 1 deletion dd-java-agent/instrumentation/mule-4/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ muzzle {
module = 'mule-core'
versions = '[4.5.0,)'
javaVersion = "17"
excludeDependency 'om.google.guava:guava'
excludeDependency 'com.google.code.findbugs:jsr305'
additionalDependencies +="org.mule.runtime:mule-tracer-customization-impl:4.5.0"
}
Expand All @@ -22,6 +23,7 @@ muzzle {
module = 'mule-tracer-customization-impl'
versions = '[4.5.0,)'
javaVersion = "17"
excludeDependency 'om.google.guava:guava'
excludeDependency 'com.google.code.findbugs:jsr305'
additionalDependencies +="org.mule.runtime:mule-core:4.5.0"
}
Expand All @@ -30,8 +32,9 @@ muzzle {
group = 'org.mule.runtime'
module = 'mule-core'
versions = '[4.5.0,)'
assertInverse true
javaVersion = "17"
assertInverse true
excludeDependency 'om.google.guava:guava'
excludeDependency 'com.google.code.findbugs:jsr305'
additionalDependencies +="org.mule.runtime:mule-tracer-customization-impl:4.5.0"
}
Expand Down Expand Up @@ -119,6 +122,8 @@ dependencies {
testImplementation project(':dd-java-agent:instrumentation:grizzly-http-2.3.20')
testImplementation project(':dd-java-agent:instrumentation:grizzly-client-1.9')
testImplementation project(':dd-java-agent:instrumentation:caffeine')
testImplementation project(':dd-java-agent:instrumentation:quartz-2')


testImplementation group: 'org.mule.runtime', name: 'mule-module-launcher', version: muleVersion
testImplementation group: 'org.mule.runtime', name: 'mule-core', version: muleVersion
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
package datadog.trace.instrumentation.mule4;

import static datadog.trace.agent.tooling.bytebuddy.matcher.NameMatchers.named;
import static datadog.trace.agent.tooling.bytebuddy.matcher.NameMatchers.namedOneOf;
import static net.bytebuddy.matcher.ElementMatchers.isMethod;
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.agent.tooling.bytebuddy.matcher.NameMatchers;
import datadog.trace.bootstrap.InstrumentationContext;
import datadog.trace.bootstrap.instrumentation.api.AgentScope;
import datadog.trace.bootstrap.instrumentation.api.AgentTracer;
import net.bytebuddy.asm.Advice;
import net.bytebuddy.matcher.ElementMatchers;
import org.mule.runtime.api.event.EventContext;
import org.mule.runtime.core.api.event.CoreEvent;
import org.mule.runtime.tracer.api.EventTracer;
Expand All @@ -18,7 +21,7 @@
* handler.
*/
@AutoService(InstrumenterModule.class)
public class ComponentMessageInstrumentation extends AbstractMuleInstrumentation
public class ComponentMessageProcessorInstrumentation extends AbstractMuleInstrumentation
implements Instrumenter.ForSingleType {

@Override
Expand All @@ -29,11 +32,9 @@ public String instrumentedType() {
@Override
public void methodAdvice(MethodTransformer transformer) {
transformer.applyAdvice(
ElementMatchers.isMethod()
.and(NameMatchers.namedOneOf("onEvent", "onEventSynchronous"))
.and(
ElementMatchers.takesArgument(
0, NameMatchers.named("org.mule.runtime.core.api.event.CoreEvent"))),
isMethod()
.and(namedOneOf("onEvent", "onEventSynchronous", "prepareAndExecuteOperation"))
.and(takesArgument(0, named("org.mule.runtime.core.api.event.CoreEvent"))),
getClass().getName() + "$ProcessAdvice");
}

Expand Down

0 comments on commit 12741f5

Please sign in to comment.