Hard-code Hystrix operation (span) name, leaving the resource name dynamic
MODIFY
dd-java-agent/instrumentation/hystrix-1.4/src/main/java/datadog/trace/instrumentation/hystrix/HystrixCommandInstrumentation.java
dd-java-agent/instrumentation/hystrix-1.4/src/main/java/datadog/trace/instrumentation/hystrix/HystrixCommandInstrumentation.java
@@ -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 operationName = "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)
+ .withTag(DDTags.RESOURCE_NAME, resourceName)
.withTag(Tags.COMPONENT.getKey(), "hystrix")
.startActive(true);
}

MODIFY
dd-java-agent/instrumentation/hystrix-1.4/src/test/groovy/HystrixTest.groovy
dd-java-agent/instrumentation/hystrix-1.4/src/test/groovy/HystrixTest.groovy
@@ -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)

Hard-code Hystrix operation (span) name, leaving the resource name dynamic