Remove operation name decorators
MODIFY
dd-java-agent/instrumentation/aws-java-sdk-1.11.0/src/main/java/datadog/trace/instrumentation/aws/v0/TracingRequestHandler.java
dd-java-agent/instrumentation/aws-java-sdk-1.11.0/src/main/java/datadog/trace/instrumentation/aws/v0/TracingRequestHandler.java
@@ -28,7 +28,7 @@ public class TracingRequestHandler extends RequestHandler2 {
@Override
public void beforeRequest(final Request<?> request) {
- final AgentSpan span = startSpan("aws.command");
+ final AgentSpan span = startSpan("aws.http");
DECORATE.afterStart(span);
DECORATE.onRequest(span, request);
request.addHandlerContext(SCOPE_CONTEXT_KEY, activateSpan(span, true));

MODIFY
dd-java-agent/instrumentation/aws-java-sdk-2.2/src/main/java8/datadog/trace/instrumentation/aws/v2/TracingExecutionInterceptor.java
dd-java-agent/instrumentation/aws-java-sdk-2.2/src/main/java8/datadog/trace/instrumentation/aws/v2/TracingExecutionInterceptor.java
@@ -29,7 +29,7 @@ public class TracingExecutionInterceptor implements ExecutionInterceptor {
@Override
public void beforeExecution(
final Context.BeforeExecution context, final ExecutionAttributes executionAttributes) {
- final AgentSpan span = startSpan("aws.command");
+ final AgentSpan span = startSpan("aws.http");
try (final AgentScope scope = activateSpan(span, false)) {
DECORATE.afterStart(span);
executionAttributes.putAttribute(SPAN_ATTRIBUTE, span);

MODIFY
dd-java-agent/instrumentation/datastax-cassandra-3/src/main/java/datadog/trace/instrumentation/datastax/cassandra/TracingSession.java
dd-java-agent/instrumentation/datastax-cassandra-3/src/main/java/datadog/trace/instrumentation/datastax/cassandra/TracingSession.java
@@ -234,7 +234,7 @@ public class TracingSession implements Session {
}
private AgentScope startSpanWithScope(final String query) {
- final AgentSpan span = startSpan("cassandra.execute");
+ final AgentSpan span = startSpan("cassandra.query");
DECORATE.afterStart(span);
DECORATE.onConnection(span, session);
DECORATE.onStatement(span, query);

MODIFY
dd-java-agent/instrumentation/java-concurrent/src/slickTest/groovy/SlickTest.groovy
dd-java-agent/instrumentation/java-concurrent/src/slickTest/groovy/SlickTest.groovy
@@ -29,7 +29,7 @@ class SlickTest extends AgentTestRunner {
}
}
span(1) {
- operationName "${SlickUtils.Driver()}.query"
+ operationName "database.query"
spanType DDSpanTypes.SQL
childOf span(0)
errored false

MODIFY
dd-java-agent/instrumentation/jdbc/src/test/groovy/JDBCInstrumentationTest.groovy
dd-java-agent/instrumentation/jdbc/src/test/groovy/JDBCInstrumentationTest.groovy
@@ -170,7 +170,7 @@ class JDBCInstrumentationTest extends AgentTestRunner {
trace(0, 2) {
basicSpan(it, 0, "parent")
span(1) {
- operationName "${driver}.query"
+ operationName "database.query"
spanType DDSpanTypes.SQL
childOf span(0)
errored false
@@ -231,7 +231,7 @@ class JDBCInstrumentationTest extends AgentTestRunner {
trace(0, 2) {
basicSpan(it, 0, "parent")
span(1) {
- operationName "${driver}.query"
+ operationName "database.query"
spanType DDSpanTypes.SQL
childOf span(0)
errored false
@@ -284,7 +284,7 @@ class JDBCInstrumentationTest extends AgentTestRunner {
trace(0, 2) {
basicSpan(it, 0, "parent")
span(1) {
- operationName "${driver}.query"
+ operationName "database.query"
spanType DDSpanTypes.SQL
childOf span(0)
errored false
@@ -337,7 +337,7 @@ class JDBCInstrumentationTest extends AgentTestRunner {
trace(0, 2) {
basicSpan(it, 0, "parent")
span(1) {
- operationName "${driver}.query"
+ operationName "database.query"
spanType DDSpanTypes.SQL
childOf span(0)
errored false
@@ -390,7 +390,7 @@ class JDBCInstrumentationTest extends AgentTestRunner {
trace(0, 2) {
basicSpan(it, 0, "parent")
span(1) {
- operationName "${driver}.query"
+ operationName "database.query"
spanType DDSpanTypes.SQL
childOf span(0)
errored false
@@ -446,7 +446,7 @@ class JDBCInstrumentationTest extends AgentTestRunner {
trace(0, 2) {
basicSpan(it, 0, "parent")
span(1) {
- operationName "${driver}.query"
+ operationName "database.query"
spanType DDSpanTypes.SQL
childOf span(0)
errored false
@@ -515,7 +515,7 @@ class JDBCInstrumentationTest extends AgentTestRunner {
trace(0, 2) {
basicSpan(it, 0, "parent")
span(1) {
- operationName "${driver}.query"
+ operationName "database.query"
spanType DDSpanTypes.SQL
childOf span(0)
errored false
@@ -592,7 +592,7 @@ class JDBCInstrumentationTest extends AgentTestRunner {
assertTraces(5) {
trace(0, 1) {
span(0) {
- operationName "${dbType}.query"
+ operationName "database.query"
spanType DDSpanTypes.SQL
errored false
tags {
@@ -612,7 +612,7 @@ class JDBCInstrumentationTest extends AgentTestRunner {
for (int i = 1; i < numQueries; ++i) {
trace(i, 1) {
span(0) {
- operationName "${dbType}.query"
+ operationName "database.query"
spanType DDSpanTypes.SQL
errored false
tags {

MODIFY
dd-java-agent/instrumentation/jedis-1.4/src/main/java/datadog/trace/instrumentation/jedis/JedisInstrumentation.java
dd-java-agent/instrumentation/jedis-1.4/src/main/java/datadog/trace/instrumentation/jedis/JedisInstrumentation.java
@@ -60,7 +60,7 @@ public final class JedisInstrumentation extends Instrumenter.Default {
@Advice.OnMethodEnter(suppress = Throwable.class)
public static AgentScope onEnter(@Advice.Argument(1) final Command command) {
- final AgentSpan span = startSpan("redis.command");
+ final AgentSpan span = startSpan("redis.query");
DECORATE.afterStart(span);
DECORATE.onStatement(span, command.name());
return activateSpan(span, true);

MODIFY
dd-trace-ot/src/main/java/datadog/opentracing/decorators/DBTypeDecorator.java
dd-trace-ot/src/main/java/datadog/opentracing/decorators/DBTypeDecorator.java
@@ -34,8 +34,6 @@ public class DBTypeDecorator extends AbstractDecorator {
} else {
context.setSpanType(DDSpanTypes.SQL);
}
- // Works for: mongo, cassandra, jdbc
- context.setOperationName(String.valueOf(value) + ".query");
return true;
}
}

MODIFY
dd-trace-ot/src/main/java/datadog/opentracing/decorators/DDDecoratorsFactory.java
dd-trace-ot/src/main/java/datadog/opentracing/decorators/DDDecoratorsFactory.java
@@ -8,10 +8,6 @@ public class DDDecoratorsFactory {
public static List<AbstractDecorator> createBuiltinDecorators() {
return Arrays.asList(
- new DBTypeDecorator(),
- new ErrorFlag(),
- new OperationDecorator(),
- new SpanTypeDecorator(),
- new Status5XXDecorator());
+ new DBTypeDecorator(), new ErrorFlag(), new SpanTypeDecorator(), new Status5XXDecorator());
}
}

DELETE
dd-trace-ot/src/main/java/datadog/opentracing/decorators/OperationDecorator.java
-package datadog.opentracing.decorators;
-
-import datadog.opentracing.DDSpanContext;
-import io.opentracing.tag.Tags;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * This span decorator is a simple mapping to override the operation DB tags. The operation name of
- * DB decorators are handled by the DBTypeDecorator
- */
-public class OperationDecorator extends AbstractDecorator {
-
- static final Map<String, String> MAPPINGS;
-
- static {
- final Map<String, String> mappings = new HashMap<>();
- // Component name <> Operation name
- mappings.put("java-aws-sdk", "aws.http");
- // FIXME: JMS ops card is low (jms-send or jms-receive), may be this mapping is useless
- mappings.put("java-jms", "jms");
- // Cassandra, Mongo, JDBC are set via DBTypeDecorator
- MAPPINGS = Collections.unmodifiableMap(mappings);
- }
-
- public OperationDecorator() {
- super();
- setMatchingTag(Tags.COMPONENT.getKey());
- }
-
- @Override
- public boolean shouldSetTag(final DDSpanContext context, final String tag, final Object value) {
- if (MAPPINGS.containsKey(String.valueOf(value))) {
- context.setOperationName(MAPPINGS.get(String.valueOf(value)));
- }
- return true;
- }
-}

MODIFY
dd-trace-ot/src/test/groovy/datadog/opentracing/decorators/SpanDecoratorTest.groovy
dd-trace-ot/src/test/groovy/datadog/opentracing/decorators/SpanDecoratorTest.groovy
@@ -35,18 +35,6 @@ class SpanDecoratorTest extends DDSpecification {
span.getTags().get("newFoo") == "newBar"
}
- def "set operation name"() {
- when:
- Tags.COMPONENT.set(span, component)
-
- then:
- span.getOperationName() == operationName
-
- where:
- component << OperationDecorator.MAPPINGS.keySet()
- operationName << OperationDecorator.MAPPINGS.values()
- }
-
def "set span type"() {
when:
span.setTag(DDTags.SPAN_TYPE, type)
@@ -58,12 +46,12 @@ class SpanDecoratorTest extends DDSpecification {
type = DDSpanTypes.HTTP_CLIENT
}
- def "override operation with DBTypeDecorator"() {
+
+ def "set span type with DBTypeDecorator"() {
when:
Tags.DB_TYPE.set(span, type)
then:
- span.getOperationName() == type + ".query"
span.context().getSpanType() == "sql"
@@ -71,7 +59,6 @@ class SpanDecoratorTest extends DDSpecification {
Tags.DB_TYPE.set(span, "mongo")
then:
- span.getOperationName() == "mongo.query"
span.context().getSpanType() == "mongodb"
where:

MODIFY
dd-trace-ot/src/test/groovy/datadog/trace/DDTracerTest.groovy
dd-trace-ot/src/test/groovy/datadog/trace/DDTracerTest.groovy
@@ -35,7 +35,7 @@ class DDTracerTest extends DDSpecification {
def tracer = new DDTracer()
then:
- tracer.spanContextDecorators.size() == 5
+ tracer.spanContextDecorators.size() == 4
tracer.injector instanceof DatadogHttpCodec.Injector
tracer.extractor instanceof DatadogHttpCodec.Extractor

Remove operation name decorators (#36)