Don’t change resource name of span unless it’s for Rabbit.
This commit is contained in:
parent
64595cf485
commit
97dd303909
|
|
@ -11,6 +11,7 @@ import com.rabbitmq.client.Command;
|
|||
import com.rabbitmq.client.Method;
|
||||
import datadog.trace.agent.tooling.Instrumenter;
|
||||
import datadog.trace.api.DDTags;
|
||||
import datadog.trace.api.interceptor.MutableSpan;
|
||||
import io.opentracing.Span;
|
||||
import io.opentracing.util.GlobalTracer;
|
||||
import java.util.Collections;
|
||||
|
|
@ -50,13 +51,16 @@ public class RabbitCommandInstrumentation extends Instrumenter.Default {
|
|||
final Span span = GlobalTracer.get().activeSpan();
|
||||
|
||||
final Method method = command.getMethod();
|
||||
if (span != null && method != null) {
|
||||
final String name = method.protocolMethodName();
|
||||
if (!name.equals("basic.publish")) {
|
||||
// Don't overwrite the name already set.
|
||||
span.setTag(DDTags.RESOURCE_NAME, name);
|
||||
if (span instanceof MutableSpan && method != null) {
|
||||
if (((MutableSpan) span).getOperationName().equals("amqp.command")) {
|
||||
final String name = method.protocolMethodName();
|
||||
|
||||
if (!name.equals("basic.publish")) {
|
||||
// Don't overwrite the name already set.
|
||||
span.setTag(DDTags.RESOURCE_NAME, name);
|
||||
}
|
||||
span.setTag("amqp.command", name);
|
||||
}
|
||||
span.setTag("amqp.command", name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue