Merge pull request #855 from DataDog/mar-kolya/rabbitmq-client-service-name

Use default service name for RabbitMQ consumer
This commit is contained in:
Nikolay Martynov 2019-05-24 10:51:28 -04:00 committed by GitHub
commit 82f1a485d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 1 deletions

View File

@ -27,6 +27,16 @@ public class RabbitDecorator extends ClientDecorator {
public static final RabbitDecorator CONSUMER_DECORATE = public static final RabbitDecorator CONSUMER_DECORATE =
new RabbitDecorator() { new RabbitDecorator() {
@Override
protected String service() {
/*
Use default service name. Common use-case here is to have consumer span parent
children spans in instrumented application. Since service name is inherited it makes
sense to default that to application service name rather than 'rabbitmq'.
*/
return null;
}
@Override @Override
protected String spanKind() { protected String spanKind() {
return Tags.SPAN_KIND_CONSUMER; return Tags.SPAN_KIND_CONSUMER;

View File

@ -341,7 +341,14 @@ class RabbitMQTest extends AgentTestRunner {
String errorMsg = null String errorMsg = null
) { ) {
trace.span(index) { trace.span(index) {
serviceName "rabbitmq" switch (span.tags["amqp.command"]) {
case "basic.get":
case "basic.deliver":
serviceName "unnamed-java-app"
break
default:
serviceName "rabbitmq"
}
operationName "amqp.command" operationName "amqp.command"
resourceName resource resourceName resource
switch (span.tags["amqp.command"]) { switch (span.tags["amqp.command"]) {