Merge pull request #683 from DataDog/willgittoes-dd/hystrix-operation-name

Hard-code Hystrix operation (span) name, leaving the resource name dynamic
This commit is contained in:
Will Gittoes 2019-02-01 09:44:29 +11:00 committed by GitHub
commit 558cd9a3b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 5 deletions

1
.gitignore vendored
View File

@ -51,5 +51,6 @@ out/
/workspace
dd-java-agent/benchmark-integration/perf-test-settings.rc
derby.log
.java-version
!dd-java-agent/benchmark/releases/*.jar

View File

@ -10,6 +10,7 @@ import static net.bytebuddy.matcher.ElementMatchers.not;
import com.google.auto.service.AutoService;
import datadog.trace.agent.tooling.Instrumenter;
import datadog.trace.api.DDTags;
import io.opentracing.Scope;
import io.opentracing.Span;
import io.opentracing.tag.Tags;
@ -25,6 +26,8 @@ import net.bytebuddy.matcher.ElementMatcher;
@AutoService(Instrumenter.class)
public class HystrixCommandInstrumentation extends Instrumenter.Default {
private static final String OPERATION_NAME = "hystrix.cmd";
public HystrixCommandInstrumentation() {
super("hystrix");
}
@ -57,10 +60,11 @@ public class HystrixCommandInstrumentation extends Instrumenter.Default {
}
}
}
final String operationName = className + "." + method.getName();
final String resourceName = className + "." + method.getName();
return GlobalTracer.get()
.buildSpan(operationName)
.buildSpan(OPERATION_NAME)
.withTag(DDTags.RESOURCE_NAME, resourceName)
.withTag(Tags.COMPONENT.getKey(), "hystrix")
.startActive(true);
}

View File

@ -51,7 +51,7 @@ class HystrixTest extends AgentTestRunner {
}
span(1) {
serviceName "unnamed-java-app"
operationName "HystrixTest\$1.run"
operationName "hystrix.cmd"
resourceName "HystrixTest\$1.run"
spanType null
childOf span(0)
@ -125,7 +125,7 @@ class HystrixTest extends AgentTestRunner {
}
span(1) {
serviceName "unnamed-java-app"
operationName "HystrixTest\$2.getFallback"
operationName "hystrix.cmd"
resourceName "HystrixTest\$2.getFallback"
spanType null
childOf span(0)
@ -137,7 +137,7 @@ class HystrixTest extends AgentTestRunner {
}
span(2) {
serviceName "unnamed-java-app"
operationName "HystrixTest\$2.run"
operationName "hystrix.cmd"
resourceName "HystrixTest\$2.run"
spanType null
childOf span(0)