forked from DataDog/dd-trace-java
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
131 changed files
with
5,380 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[submodule "dd-java-agent/agent-jmxfetch/integrations-core"] | ||
path = dd-java-agent/agent-jmxfetch/integrations-core | ||
url = https://github.com/DataDog/integrations-core.git | ||
url = https://github.com/GuanceCloud/integrations-core.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule integrations-core
updated
7438 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
muzzle { | ||
pass { | ||
group = "org.apache.axis" | ||
module = "axis" | ||
versions = "[1.4,)" | ||
} | ||
} | ||
|
||
apply from: "$rootDir/gradle/java.gradle" | ||
|
||
|
||
dependencies { | ||
compileOnly group: 'org.apache.axis', name: 'axis', version: '1.4' | ||
compileOnly group: 'axis', name: 'axis-jaxrpc', version: '1.4' | ||
} | ||
|
98 changes: 98 additions & 0 deletions
98
...n/axis-1/src/main/java/datadog/trace/instrumentation/axis1/AxisClientInstrumentation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
package datadog.trace.instrumentation.axis1; | ||
|
||
import com.google.auto.service.AutoService; | ||
import datadog.trace.agent.tooling.Instrumenter; | ||
import datadog.trace.bootstrap.instrumentation.api.AgentScope; | ||
import datadog.trace.bootstrap.instrumentation.api.AgentSpan; | ||
import net.bytebuddy.asm.Advice; | ||
import net.bytebuddy.description.type.TypeDescription; | ||
import net.bytebuddy.matcher.ElementMatcher; | ||
import org.apache.axis.MessageContext; | ||
|
||
import static datadog.trace.agent.tooling.bytebuddy.matcher.HierarchyMatchers.implementsInterface; | ||
import static datadog.trace.agent.tooling.bytebuddy.matcher.NameMatchers.named; | ||
import static datadog.trace.bootstrap.instrumentation.api.AgentTracer.*; | ||
import static datadog.trace.instrumentation.axis1.AxisMessageDecorator.AXIS2_MESSAGE; | ||
import static datadog.trace.instrumentation.axis1.AxisMessageDecorator.DECORATE; | ||
import static net.bytebuddy.matcher.ElementMatchers.isMethod; | ||
import static net.bytebuddy.matcher.ElementMatchers.takesArgument; | ||
|
||
@AutoService(Instrumenter.class) | ||
public final class AxisClientInstrumentation extends Instrumenter.Tracing | ||
implements Instrumenter.ForTypeHierarchy { | ||
|
||
public AxisClientInstrumentation() {super("axis1");} | ||
|
||
|
||
@Override | ||
public String hierarchyMarkerType() { | ||
return "org.apache.axis.Handler"; | ||
} | ||
|
||
@Override | ||
public String[] helperClassNames() { | ||
return new String[] { | ||
packageName + ".AxisMessageDecorator", | ||
}; | ||
} | ||
|
||
@Override | ||
public ElementMatcher<TypeDescription> hierarchyMatcher() { | ||
return implementsInterface(named(hierarchyMarkerType())); | ||
} | ||
|
||
@Override | ||
public void adviceTransformations(AdviceTransformation transformation) { | ||
transformation.applyAdvice( | ||
isMethod() | ||
.and(named("invoke")) | ||
.and(takesArgument(0, named("org.apache.axis.MessageContext"))), | ||
getClass().getName() + "$ClientInvokeMessageAdvice"); | ||
} | ||
|
||
public static final class ClientInvokeMessageAdvice { | ||
@Advice.OnMethodEnter(suppress = Throwable.class) | ||
public static AgentScope beginInvoke( | ||
@Advice.Argument(0) final MessageContext message) { | ||
if (null == message ){ | ||
return null; | ||
} | ||
|
||
if (null == message.getOperation()){ | ||
return null; | ||
} | ||
|
||
AgentScope scope = activeScope(); | ||
if (null != scope) { | ||
if (!DECORATE.sameTrace(scope.span(), message)) { | ||
AgentSpan span = startSpan(AXIS2_MESSAGE); | ||
DECORATE.afterStart(span); | ||
DECORATE.onMessage(span, message); | ||
return activateSpan(span); | ||
} | ||
} | ||
return null; | ||
} | ||
|
||
@Advice.OnMethodExit(onThrowable = Throwable.class,suppress = Throwable.class) | ||
public static void endInvoke( | ||
@Advice.Enter final AgentScope scope, | ||
@Advice.Argument(0) final MessageContext message, | ||
@Advice.Thrown final Throwable error){ | ||
if (null == message){ | ||
return ; | ||
} | ||
if (null == scope) { | ||
return; | ||
} | ||
System.out.println("getSoapAction name"+message.getOperation().getSoapAction()); | ||
AgentSpan span = scope.span(); | ||
if (null != error) { | ||
DECORATE.onError(span, error); | ||
} | ||
DECORATE.beforeFinish(span, message); | ||
scope.close(); | ||
span.finish(); | ||
} | ||
} | ||
} |
Oops, something went wrong.