Commit 76fb55f
authored
Report gRPC status code in client-computed stats (#10805)
fix(ccs): Reports gRPC status code in CCS
# Conflicts:
# dd-trace-core/src/main/java/datadog/trace/common/metrics/MetricKey.java
fix(ccs): Use captured gRPC status code numeric in metric aggregation
When client-computed stats (CCS) are enabled, the agent **merges** stats
it computes itself from raw spans with stats pre-computed by the tracer.
For gRPC spans, without Client Computed Stats (metrics) the agent
resolves the status code from the span's tags via
[`getGRPCStatusCode()`](https://github.com/DataDog/datadog-agent/blob/47938ea8c9b9894dcb03dc3f81cf2c6e408f1b6c/pkg/trace/stats/aggregation.go#L167-L221),
which always returns a numeric string (e.g. `4`) or an empty string.
With CCS enabled, the code uses [`GRPCStatusCode`](https://github.com/DataDog/datadog-agent/blob/47938ea8c9b9894dcb03dc3f81cf2c6e408f1b6c/pkg/trace/stats/aggregation.go#L160)
without translation.
This change mimics the aggregation of the agent, and what is expected
from the agent, in [`NewAggregationFromGroup`](https://github.com/DataDog/datadog-agent/blob/47938ea8c9b9894dcb03dc3f81cf2c6e408f1b6c/pkg/trace/stats/aggregation.go#L146-L165).
Protocol wise
[ClientGroupedStats.GRPC_status_code](https://github.com/DataDog/datadog-agent/blob/47938ea8c9b9894dcb03dc3f81cf2c6e408f1b6c/pkg/proto/datadog/trace/stats.proto#L103)
is a `string`.
chore(ccs): Use InstrumentationTags
Merge branch 'master' into bdu/report-grpc-status-code-to-tracer-client-computed-stats
Merge branch 'master' into bdu/report-grpc-status-code-to-tracer-client-computed-stats
Co-authored-by: brice.dutheil <brice.dutheil@datadoghq.com>1 parent 8b4302a commit 76fb55f
File tree
18 files changed
+252
-30
lines changed- dd-java-agent/instrumentation
- armeria/armeria-grpc-0.84/src
- main/java/datadog/trace/instrumentation/armeria/grpc
- client
- server
- test/groovy
- google-pubsub-1.116/src/test/groovy
- grpc-1.5/src
- main/java/datadog/trace/instrumentation/grpc
- client
- server
- test/groovy
- dd-trace-core/src
- main/java/datadog/trace/common/metrics
- test/groovy/datadog/trace/common/metrics
- traceAgentTest/groovy
- internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api
18 files changed
+252
-30
lines changedLines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
116 | 117 | | |
117 | 118 | | |
118 | 119 | | |
| 120 | + | |
119 | 121 | | |
120 | 122 | | |
121 | 123 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
97 | 98 | | |
98 | 99 | | |
99 | 100 | | |
| 101 | + | |
100 | 102 | | |
101 | 103 | | |
102 | 104 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
178 | 179 | | |
179 | 180 | | |
180 | 181 | | |
| 182 | + | |
181 | 183 | | |
182 | 184 | | |
183 | 185 | | |
| |||
215 | 217 | | |
216 | 218 | | |
217 | 219 | | |
| 220 | + | |
218 | 221 | | |
219 | 222 | | |
220 | 223 | | |
| |||
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
182 | 183 | | |
183 | 184 | | |
184 | 185 | | |
| 186 | + | |
185 | 187 | | |
186 | 188 | | |
187 | 189 | | |
| |||
221 | 223 | | |
222 | 224 | | |
223 | 225 | | |
| 226 | + | |
224 | 227 | | |
225 | 228 | | |
226 | 229 | | |
| |||
319 | 322 | | |
320 | 323 | | |
321 | 324 | | |
| 325 | + | |
322 | 326 | | |
323 | 327 | | |
324 | 328 | | |
| |||
343 | 347 | | |
344 | 348 | | |
345 | 349 | | |
| 350 | + | |
346 | 351 | | |
347 | 352 | | |
348 | 353 | | |
| |||
432 | 437 | | |
433 | 438 | | |
434 | 439 | | |
| 440 | + | |
435 | 441 | | |
436 | 442 | | |
437 | 443 | | |
| |||
459 | 465 | | |
460 | 466 | | |
461 | 467 | | |
| 468 | + | |
462 | 469 | | |
463 | 470 | | |
464 | 471 | | |
| |||
574 | 581 | | |
575 | 582 | | |
576 | 583 | | |
| 584 | + | |
577 | 585 | | |
578 | 586 | | |
579 | 587 | | |
| |||
650 | 658 | | |
651 | 659 | | |
652 | 660 | | |
| 661 | + | |
653 | 662 | | |
654 | 663 | | |
655 | 664 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
284 | 285 | | |
285 | 286 | | |
286 | 287 | | |
| 288 | + | |
287 | 289 | | |
288 | 290 | | |
289 | 291 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
116 | 117 | | |
117 | 118 | | |
118 | 119 | | |
| 120 | + | |
119 | 121 | | |
120 | 122 | | |
121 | 123 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
98 | 99 | | |
99 | 100 | | |
100 | 101 | | |
| 102 | + | |
101 | 103 | | |
102 | 104 | | |
103 | 105 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
162 | 163 | | |
163 | 164 | | |
164 | 165 | | |
| 166 | + | |
165 | 167 | | |
166 | 168 | | |
167 | 169 | | |
| |||
198 | 200 | | |
199 | 201 | | |
200 | 202 | | |
| 203 | + | |
201 | 204 | | |
202 | 205 | | |
203 | 206 | | |
| |||
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
17 | 18 | | |
18 | 19 | | |
| |||
173 | 174 | | |
174 | 175 | | |
175 | 176 | | |
| 177 | + | |
176 | 178 | | |
177 | 179 | | |
178 | 180 | | |
| |||
212 | 214 | | |
213 | 215 | | |
214 | 216 | | |
| 217 | + | |
215 | 218 | | |
216 | 219 | | |
217 | 220 | | |
| |||
317 | 320 | | |
318 | 321 | | |
319 | 322 | | |
| 323 | + | |
320 | 324 | | |
321 | 325 | | |
322 | 326 | | |
| |||
341 | 345 | | |
342 | 346 | | |
343 | 347 | | |
| 348 | + | |
344 | 349 | | |
345 | 350 | | |
346 | 351 | | |
| |||
424 | 429 | | |
425 | 430 | | |
426 | 431 | | |
| 432 | + | |
427 | 433 | | |
428 | 434 | | |
429 | 435 | | |
| |||
448 | 454 | | |
449 | 455 | | |
450 | 456 | | |
| 457 | + | |
451 | 458 | | |
452 | 459 | | |
453 | 460 | | |
| |||
554 | 561 | | |
555 | 562 | | |
556 | 563 | | |
| 564 | + | |
557 | 565 | | |
558 | 566 | | |
559 | 567 | | |
| |||
621 | 629 | | |
622 | 630 | | |
623 | 631 | | |
| 632 | + | |
624 | 633 | | |
625 | 634 | | |
626 | 635 | | |
| |||
Lines changed: 11 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| 33 | + | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
| |||
326 | 328 | | |
327 | 329 | | |
328 | 330 | | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
329 | 337 | | |
330 | 338 | | |
331 | 339 | | |
332 | 340 | | |
333 | 341 | | |
334 | 342 | | |
335 | | - | |
| 343 | + | |
336 | 344 | | |
337 | 345 | | |
338 | 346 | | |
339 | 347 | | |
340 | 348 | | |
341 | 349 | | |
342 | 350 | | |
343 | | - | |
| 351 | + | |
| 352 | + | |
344 | 353 | | |
345 | 354 | | |
346 | 355 | | |
| |||
0 commit comments