Skip to content

Commit a31bd14

Browse files
authored
Changing GRPC instrumentation codes from status.code to grpc.status.code (#9367)
* Changing GRPC instrumentation codes from status.code to grpc.status.code * adding grpc.status.code to pubsub tests * updating to have both tags be sent
1 parent 1f35448 commit a31bd14

File tree

9 files changed

+25
-1
lines changed

9 files changed

+25
-1
lines changed

dd-java-agent/instrumentation/armeria/armeria-grpc-0.84/src/main/java/datadog/trace/instrumentation/armeria/grpc/client/GrpcClientDecorator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ public <C> void injectContext(Context context, final C request, CarrierSetter<C>
115115
public AgentSpan onClose(final AgentSpan span, final Status status) {
116116

117117
span.setTag("status.code", status.getCode().name());
118+
span.setTag("grpc.status.code", status.getCode().name());
118119
span.setTag("status.description", status.getDescription());
119120

120121
// TODO why is there a mismatch between client / server for calling the onError method?

dd-java-agent/instrumentation/armeria/armeria-grpc-0.84/src/main/java/datadog/trace/instrumentation/armeria/grpc/server/GrpcServerDecorator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public <RespT, ReqT> AgentSpan onCall(final AgentSpan span, ServerCall<ReqT, Res
9696

9797
public AgentSpan onStatus(final AgentSpan span, final Status status) {
9898
span.setTag("status.code", status.getCode().name());
99+
span.setTag("grpc.status.code", status.getCode().name());
99100
span.setTag("status.description", status.getDescription());
100101
return span.setError(
101102
SERVER_ERROR_STATUSES.get(status.getCode().value()), ErrorPriorities.HTTP_SERVER_DECORATOR);

dd-java-agent/instrumentation/armeria/armeria-grpc-0.84/src/test/groovy/ArmeriaGrpcStreamingTest.groovy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ abstract class ArmeriaGrpcStreamingTest extends VersionedNamingTestBase {
177177
"$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT
178178
"$Tags.RPC_SERVICE" "example.Greeter"
179179
"status.code" "OK"
180+
"grpc.status.code" "OK"
180181
"request.type" "example.Helloworld\$Response"
181182
"response.type" "example.Helloworld\$Response"
182183
peerServiceFrom(Tags.RPC_SERVICE)
@@ -213,6 +214,7 @@ abstract class ArmeriaGrpcStreamingTest extends VersionedNamingTestBase {
213214
"$Tags.COMPONENT" "armeria-grpc-server"
214215
"$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER
215216
"status.code" "OK"
217+
"grpc.status.code" "OK"
216218
defaultTags(true)
217219
}
218220
}

dd-java-agent/instrumentation/armeria/armeria-grpc-0.84/src/test/groovy/ArmeriaGrpcTest.groovy

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ abstract class ArmeriaGrpcTest extends VersionedNamingTestBase {
181181
"$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT
182182
"$Tags.RPC_SERVICE" "example.Greeter"
183183
"status.code" "OK"
184+
"grpc.status.code" "OK"
184185
"request.type" "example.Helloworld\$Request"
185186
"response.type" "example.Helloworld\$Response"
186187
if ({ isDataStreamsEnabled() }) {
@@ -219,6 +220,7 @@ abstract class ArmeriaGrpcTest extends VersionedNamingTestBase {
219220
"$Tags.COMPONENT" "armeria-grpc-server"
220221
"$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER
221222
"status.code" "OK"
223+
"grpc.status.code" "OK"
222224
if ({ isDataStreamsEnabled() }) {
223225
"$DDTags.PATHWAY_HASH" { String }
224226
}
@@ -316,6 +318,7 @@ abstract class ArmeriaGrpcTest extends VersionedNamingTestBase {
316318
"$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT
317319
"$Tags.RPC_SERVICE" "example.Greeter"
318320
"status.code" "${status.code.name()}"
321+
"grpc.status.code" "${status.code.name()}"
319322
"status.description" description
320323
"request.type" "example.Helloworld\$Request"
321324
"response.type" "example.Helloworld\$Response"
@@ -339,6 +342,7 @@ abstract class ArmeriaGrpcTest extends VersionedNamingTestBase {
339342
"$Tags.COMPONENT" "armeria-grpc-server"
340343
"$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER
341344
"status.code" "${status.code.name()}"
345+
"grpc.status.code" "${status.code.name()}"
342346
"status.description" description
343347
"canceled" { true } // 1.0.0 handles cancellation incorrectly so accesting any value
344348
if (status.cause != null) {
@@ -427,6 +431,7 @@ abstract class ArmeriaGrpcTest extends VersionedNamingTestBase {
427431
"$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT
428432
"$Tags.RPC_SERVICE" "example.Greeter"
429433
"status.code" status.code.name()
434+
"grpc.status.code" status.code.name()
430435
if (status.description != null) {
431436
"status.description" status.description
432437
}
@@ -453,6 +458,7 @@ abstract class ArmeriaGrpcTest extends VersionedNamingTestBase {
453458
"$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER
454459
errorTags error.class, error.message
455460
"status.code" "${status.code.name()}"
461+
"grpc.status.code" "${status.code.name()}"
456462
"status.description" { it == null || String}
457463
"canceled" { true } // 1.0.0 handles cancellation incorrectly so accesting any value
458464
if ({ isDataStreamsEnabled() }) {
@@ -567,6 +573,7 @@ abstract class ArmeriaGrpcTest extends VersionedNamingTestBase {
567573
"$Tags.COMPONENT" "armeria-grpc-server"
568574
"$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER
569575
"status.code" "OK"
576+
"grpc.status.code" "OK"
570577
if ({ isDataStreamsEnabled() }) {
571578
"$DDTags.PATHWAY_HASH" { String }
572579
}
@@ -642,6 +649,7 @@ abstract class ArmeriaGrpcTest extends VersionedNamingTestBase {
642649
"$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT
643650
"$Tags.RPC_SERVICE" "example.Greeter"
644651
"status.code" "OK"
652+
"grpc.status.code" "OK"
645653
"request.type" "example.Helloworld\$Request"
646654
"response.type" "example.Helloworld\$Response"
647655
if ({ isDataStreamsEnabled() }) {

dd-java-agent/instrumentation/google-pubsub/src/test/groovy/PubSubTest.groovy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ abstract class PubSubTest extends VersionedNamingTestBase {
271271
"response.type" { String }
272272
"$Tags.RPC_SERVICE" { String }
273273
"status.code" { String }
274+
"grpc.status.code" { String }
274275
if ({ isDataStreamsEnabled() }) {
275276
"$DDTags.PATHWAY_HASH" { String }
276277
}

dd-java-agent/instrumentation/grpc-1.5/src/main/java/datadog/trace/instrumentation/grpc/client/GrpcClientDecorator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ public <C> void injectContext(Context context, final C request, CarrierSetter<C>
114114
}
115115

116116
public AgentSpan onClose(final AgentSpan span, final Status status) {
117-
118117
span.setTag("status.code", status.getCode().name());
118+
span.setTag("grpc.status.code", status.getCode().name());
119119
span.setTag("status.description", status.getDescription());
120120

121121
// TODO why is there a mismatch between client / server for calling the onError method?

dd-java-agent/instrumentation/grpc-1.5/src/main/java/datadog/trace/instrumentation/grpc/server/GrpcServerDecorator.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ public <RespT, ReqT> AgentSpan onCall(final AgentSpan span, ServerCall<ReqT, Res
9797

9898
public AgentSpan onStatus(final AgentSpan span, final Status status) {
9999
span.setTag("status.code", status.getCode().name());
100+
span.setTag("grpc.status.code", status.getCode().name());
100101
span.setTag("status.description", status.getDescription());
101102
return span.setError(
102103
SERVER_ERROR_STATUSES.get(status.getCode().value()), ErrorPriorities.HTTP_SERVER_DECORATOR);

dd-java-agent/instrumentation/grpc-1.5/src/test/groovy/GrpcStreamingTest.groovy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ abstract class GrpcStreamingTest extends VersionedNamingTestBase {
161161
"$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT
162162
"$Tags.RPC_SERVICE" "example.Greeter"
163163
"status.code" "OK"
164+
"grpc.status.code" "OK"
164165
"request.type" "example.Helloworld\$Response"
165166
"response.type" "example.Helloworld\$Response"
166167
peerServiceFrom(Tags.RPC_SERVICE)
@@ -196,6 +197,7 @@ abstract class GrpcStreamingTest extends VersionedNamingTestBase {
196197
"$Tags.COMPONENT" "grpc-server"
197198
"$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER
198199
"status.code" "OK"
200+
"grpc.status.code" "OK"
199201
defaultTags(true)
200202
}
201203
}

dd-java-agent/instrumentation/grpc-1.5/src/test/groovy/GrpcTest.groovy

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ abstract class GrpcTest extends VersionedNamingTestBase {
171171
"$Tags.PEER_HOST_IPV4" "127.0.0.1"
172172
"$Tags.PEER_PORT" server.port
173173
"status.code" "OK"
174+
"grpc.status.code" "OK"
174175
"request.type" "example.Helloworld\$Request"
175176
"response.type" "example.Helloworld\$Response"
176177
if ({ isDataStreamsEnabled() }) {
@@ -209,6 +210,7 @@ abstract class GrpcTest extends VersionedNamingTestBase {
209210
"$Tags.COMPONENT" "grpc-server"
210211
"$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER
211212
"status.code" "OK"
213+
"grpc.status.code" "OK"
212214
if ({ isDataStreamsEnabled() }) {
213215
"$DDTags.PATHWAY_HASH" { String }
214216
}
@@ -313,6 +315,7 @@ abstract class GrpcTest extends VersionedNamingTestBase {
313315
"$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT
314316
"$Tags.RPC_SERVICE" "example.Greeter"
315317
"status.code" "${status.code.name()}"
318+
"grpc.status.code" "${status.code.name()}"
316319
"status.description" description
317320
"request.type" "example.Helloworld\$Request"
318321
"response.type" "example.Helloworld\$Response"
@@ -336,6 +339,7 @@ abstract class GrpcTest extends VersionedNamingTestBase {
336339
"$Tags.COMPONENT" "grpc-server"
337340
"$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER
338341
"status.code" "${status.code.name()}"
342+
"grpc.status.code" "${status.code.name()}"
339343
"status.description" description
340344
if (status.cause != null) {
341345
errorTags status.cause.class, status.cause.message
@@ -418,6 +422,7 @@ abstract class GrpcTest extends VersionedNamingTestBase {
418422
"$Tags.PEER_HOST_IPV4" "127.0.0.1"
419423
"$Tags.PEER_PORT" server.port
420424
"status.code" "UNKNOWN"
425+
"grpc.status.code" "UNKNOWN"
421426
"request.type" "example.Helloworld\$Request"
422427
"response.type" "example.Helloworld\$Response"
423428
"status.description" { it == null || String}
@@ -441,6 +446,7 @@ abstract class GrpcTest extends VersionedNamingTestBase {
441446
"$Tags.COMPONENT" "grpc-server"
442447
"$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER
443448
"status.code" "${status.code.name()}"
449+
"grpc.status.code" "${status.code.name()}"
444450
"status.description" { it == null || String}
445451
errorTags error.class, error.message
446452
if ({ isDataStreamsEnabled() }) {
@@ -546,6 +552,7 @@ abstract class GrpcTest extends VersionedNamingTestBase {
546552
"$Tags.COMPONENT" "grpc-server"
547553
"$Tags.SPAN_KIND" Tags.SPAN_KIND_SERVER
548554
"status.code" "OK"
555+
"grpc.status.code" "OK"
549556
if ({ isDataStreamsEnabled() }) {
550557
"$DDTags.PATHWAY_HASH" { String }
551558
}
@@ -612,6 +619,7 @@ abstract class GrpcTest extends VersionedNamingTestBase {
612619
"$Tags.SPAN_KIND" Tags.SPAN_KIND_CLIENT
613620
"$Tags.RPC_SERVICE" "example.Greeter"
614621
"status.code" "OK"
622+
"grpc.status.code" "OK"
615623
"request.type" "example.Helloworld\$Request"
616624
"response.type" "example.Helloworld\$Response"
617625
if ({ isDataStreamsEnabled() }) {

0 commit comments

Comments
 (0)