operationName -> resourceName
Addressing review comments: operationName -> resourceName
This was vestige of the original SignalFX code
MODIFY
dd-java-agent/instrumentation/spring-data/src/main/java/datadog/trace/instrumentation/springdata/SpringDataDecorator.java
dd-java-agent/instrumentation/spring-data/src/main/java/datadog/trace/instrumentation/springdata/SpringDataDecorator.java
package datadog.trace.instrumentation.springdata;
+import datadog.opentracing.DDSpan;
import datadog.trace.agent.decorator.ClientDecorator;
+import datadog.trace.api.interceptor.MutableSpan;
import io.opentracing.Span;
import java.lang.reflect.Method;
@@ -13,7 +15,7 @@ public final class SpringDataDecorator extends ClientDecorator {
@Override
protected String service() {
- return "spring-data";
+ return null;
}
@Override
@@ -36,12 +38,9 @@ public final class SpringDataDecorator extends ClientDecorator {
assert method != null;
if (method != null) {
- final Class<?> clazz = method.getDeclaringClass();
- final String methodName = method.getName();
- final String className = clazz.getSimpleName();
- final String operationName = className + "." + methodName;
-
- span.setOperationName(operationName);
+ if ( span instanceof MutableSpan ) {
+ ((MutableSpan)span).setResourceName(spanNameForMethod(method));
+ }
}
return span;
}

MODIFY
dd-java-agent/instrumentation/spring-data/src/test/groovy/SpringJpaTest.groovy
dd-java-agent/instrumentation/spring-data/src/test/groovy/SpringJpaTest.groovy
@@ -25,8 +25,8 @@ class SpringJpaTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 2) {
span(0) {
- operationName "JpaRepository.findAll"
- serviceName "spring-data"
+ operationName "repository.operation"
+ resourceName "JpaRepository.findAll"
errored false
tags {
"$Tags.COMPONENT.key" "spring-data"
@@ -52,8 +52,8 @@ class SpringJpaTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 2) {
span(0) {
- operationName "CrudRepository.save"
- serviceName "spring-data"
+ operationName "repository.operation"
+ resourceName "CrudRepository.save"
errored false
tags {
"$Tags.COMPONENT.key" "spring-data"
@@ -79,8 +79,8 @@ class SpringJpaTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 3) {
span(0) {
- operationName "CrudRepository.save"
- serviceName "spring-data"
+ operationName "repository.operation"
+ resourceName "CrudRepository.save"
errored false
tags {
"$Tags.COMPONENT.key" "spring-data"
@@ -112,8 +112,8 @@ class SpringJpaTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 2) {
span(0) {
- operationName "JpaCustomerRepository.findByLastName"
- serviceName "spring-data"
+ operationName "repository.operation"
+ resourceName "JpaCustomerRepository.findByLastName"
errored false
tags {
"$Tags.COMPONENT.key" "spring-data"
@@ -137,8 +137,8 @@ class SpringJpaTest extends AgentTestRunner {
assertTraces(1) {
trace(0, 3) {
span(0) {
- operationName "CrudRepository.delete"
- serviceName "spring-data"
+ operationName "repository.operation"
+ resourceName "CrudRepository.delete"
errored false
tags {
"$Tags.COMPONENT.key" "spring-data"

operationName -> resourceName

Addressing review comments: operationName -> resourceName

This was vestige of the original SignalFX code