File tree Expand file tree Collapse file tree
dd-java-agent/instrumentation
main/java/datadog/trace/instrumentation/kafka_clients
kafka-streams-0.11/src/test/groovy
main/java/datadog/trace/instrumentation/rabbitmq/amqp Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212public abstract class KafkaDecorator extends ClientDecorator {
1313 public static final KafkaDecorator PRODUCER_DECORATE =
1414 new KafkaDecorator () {
15- @ Override
16- protected String service () {
17- return "kafka" ;
18- }
19-
2015 @ Override
2116 protected String spanKind () {
2217 return Tags .SPAN_KIND_PRODUCER ;
@@ -30,16 +25,6 @@ protected String spanType() {
3025
3126 public static final KafkaDecorator CONSUMER_DECORATE =
3227 new KafkaDecorator () {
33- @ Override
34- protected String service () {
35- /*
36- Use default service name. Common use-case here is to have consumer span parent
37- children spans in instrumented application. Since service name is inherited it makes
38- sense to default that to application service name rather than 'kafka'.
39- */
40- return null ;
41- }
42-
4328 @ Override
4429 protected String spanKind () {
4530 return Tags .SPAN_KIND_CONSUMER ;
@@ -56,6 +41,11 @@ protected String[] instrumentationNames() {
5641 return new String [] {"kafka" };
5742 }
5843
44+ @ Override
45+ protected String service () {
46+ return "kafka" ;
47+ }
48+
5949 @ Override
6050 protected String component () {
6151 return "java-kafka" ;
Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ class KafkaClientTest extends AgentTestRunner {
9494 trace(1 , 1 ) {
9595 // CONSUMER span 0
9696 span(0 ) {
97- serviceName " unnamed-java-app "
97+ serviceName " kafka "
9898 operationName " kafka.consume"
9999 resourceName " Consume Topic $SHARED_TOPIC "
100100 spanType " queue"
Original file line number Diff line number Diff line change @@ -80,13 +80,13 @@ class KafkaStreamsTest extends AgentTestRunner {
8080 KStream<String , String > textLines = builder. stream(STREAM_PENDING )
8181 def values = textLines
8282 .mapValues(new ValueMapper<String , String > () {
83- @Override
84- String apply (String textLine ) {
85- TEST_WRITER . waitForTraces(1 ) // ensure consistent ordering of traces
86- getTestTracer(). activeSpan(). setTag(" asdf" , " testing" )
87- return textLine. toLowerCase()
88- }
89- })
83+ @Override
84+ String apply (String textLine ) {
85+ TEST_WRITER . waitForTraces(1 ) // ensure consistent ordering of traces
86+ getTestTracer(). activeSpan(). setTag(" asdf" , " testing" )
87+ return textLine. toLowerCase()
88+ }
89+ })
9090
9191 KafkaStreams streams
9292 try {
@@ -172,7 +172,7 @@ class KafkaStreamsTest extends AgentTestRunner {
172172 trace(2 , 1 ) {
173173 // CONSUMER span 0
174174 span(0 ) {
175- serviceName " unnamed-java-app "
175+ serviceName " kafka "
176176 operationName " kafka.consume"
177177 resourceName " Consume Topic $STREAM_PROCESSED "
178178 spanType " queue"
Original file line number Diff line number Diff line change @@ -27,16 +27,6 @@ protected String spanType() {
2727
2828 public static final RabbitDecorator CONSUMER_DECORATE =
2929 new RabbitDecorator () {
30- @ Override
31- protected String service () {
32- /*
33- Use default service name. Common use-case here is to have consumer span parent
34- children spans in instrumented application. Since service name is inherited it makes
35- sense to default that to application service name rather than 'rabbitmq'.
36- */
37- return null ;
38- }
39-
4030 @ Override
4131 protected String spanKind () {
4232 return Tags .SPAN_KIND_CONSUMER ;
Original file line number Diff line number Diff line change @@ -341,14 +341,7 @@ class RabbitMQTest extends AgentTestRunner {
341341 String errorMsg = null
342342 ) {
343343 trace.span(index) {
344- switch (span.tags[" amqp. command" ]) {
345- case " basic. get" :
346- case " basic. deliver" :
347- serviceName " unnamed- java- app"
348- break
349- default:
350- serviceName " rabbitmq"
351- }
344+ serviceName " rabbitmq"
352345 operationName " amqp. command"
353346 resourceName resource
354347 switch (span.tags[" amqp. command" ]) {
You can’t perform that action at this time.
0 commit comments