Skip to content

Report gRPC status code in client-computed stats#10805

Draft
bric3 wants to merge 2 commits intomasterfrom
bdu/report-grpc-status-code-to-tracer-client-computed-stats
Draft

Report gRPC status code in client-computed stats#10805
bric3 wants to merge 2 commits intomasterfrom
bdu/report-grpc-status-code-to-tracer-client-computed-stats

Conversation

@bric3
Copy link
Contributor

@bric3 bric3 commented Mar 11, 2026

What Does This Do

Reports the gRPC status code via Client Computed Stats.

This status is supported since 7.65.0 in the agent (DataDog/datadog-agent#34220), which is the minimal version needed to support CCS as well.

Current grpc instrumentations capture the status code, but not its numeric value, so it was chosen to add a new span tag that will be used in the client aggregation.

    span.setTag("status.code", status.getCode().name());
    span.setTag("grpc.status.code", status.getCode().name());
+   span.setTag("rpc.grpc.status_code", status.getCode().value());

This affects grpc and armeria instrumentations.

Motivation

Completeness of CCS.

Additional notes

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(), which always returns a numeric string (e.g. 4) or an empty string. With CCS enabled, the code uses GRPCStatusCode without translation.

flowchart TB
      subgraph tracer["dd-trace-java"]
          span["gRPC span<br>grpc.status.code = 'DEADLINE_EXCEEDED'<br>rpc.grpc.status_code = 4"]

          span -->|raw spans| v04["POST /v0.4/traces<br>msgpack"]
          span --> agg["ConflatingMetricsAggregator<br>reads rpc.grpc.status_code<br>GRPCStatusCode = '4'"]
          agg -->|pre-computed stats| v06["POST /v0.6/stats<br>msgpack · GRPCStatusCode: '4'"]
      end

      subgraph agent["datadog-agent"]
          v04 --> agentPath["NewAggregationFromSpan<br>getGRPCStatusCode<br>meta[grpc.status.code]='DEADLINE_EXCEEDED' → '4'"]
          v06 --> ccsPath["NewAggregationFromGroup<br>GRPCStatusCode → '4'"]

          agentPath --> k1["key{GRPCStatusCode:'4',...}"]
          ccsPath   --> k2["key{GRPCStatusCode:'4',...}"]
      end
Loading

This change mimics the aggregation of the agent, and what is expected from the agent, in NewAggregationFromGroup.

Protocol wise ClientGroupedStats.GRPC_status_code is a string.

@bric3 bric3 added type: bug Bug report and fix comp: metrics Metrics labels Mar 11, 2026
@bric3 bric3 requested a review from amarziali March 11, 2026 13:30
@bric3 bric3 force-pushed the bdu/report-grpc-status-code-to-tracer-client-computed-stats branch from 9ca27a6 to b39ed92 Compare March 11, 2026 13:41
CharSequence httpMethod,
CharSequence httpEndpoint) {
CharSequence httpEndpoint,
CharSequence grpcStatusCode) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implmenetation does not look correct. AFAIK our integrations are putting a named enum on grpc.status.code

    span.setTag("status.code", status.getCode().name());

On the other side here it's required put a numeric value. The agent is doing a translation (see aggregate.go):

var grpcStatusMap = map[string]string{
	"CANCELLED":          "1",
	"CANCELED":           "1",
	"INVALIDARGUMENT":    "3",
	"DEADLINEEXCEEDED":   "4",
	"NOTFOUND":           "5",
	"ALREADYEXISTS":      "6",
	"PERMISSIONDENIED":   "7",
	"RESOURCEEXHAUSTED":  "8",
	"FAILEDPRECONDITION": "9",
	"OUTOFRANGE":         "11",
	"DATALOSS":           "15",
}

We already have those numbers. I can suggest to enrich first the in place integrations by feeding the status code under the otel tag rpc.grpc.status_code and then source the fields for the stats from this tag instead.

Please also double check that the proto accept a string and not an integer

@pr-commenter
Copy link

pr-commenter bot commented Mar 11, 2026

Benchmarks

Startup

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master bdu/report-grpc-status-code-to-tracer-client-computed-stats
git_commit_date 1773300530 1773309778
git_commit_sha c1e9ac6 a3832a0
release_version 1.61.0-SNAPSHOT~c1e9ac6389 1.61.0-SNAPSHOT~a3832a0fc0
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1773311738 1773311738
ci_job_id 1499636914 1499636914
ci_pipeline_id 102086432 102086432
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-zfyrx7zua-project-304-concurrent-1-4u2k05b4 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-zfyrx7zua-project-304-concurrent-1-4u2k05b4 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
module Agent Agent
parent None None

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 63 metrics, 8 unstable metrics.

Startup time reports for petclinic
gantt
    title petclinic - global startup overhead: candidate=1.61.0-SNAPSHOT~a3832a0fc0, baseline=1.61.0-SNAPSHOT~c1e9ac6389

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.059 s) : 0, 1058789
Total [baseline] (11.023 s) : 0, 11023165
Agent [candidate] (1.06 s) : 0, 1060448
Total [candidate] (11.084 s) : 0, 11084022
section appsec
Agent [baseline] (1.254 s) : 0, 1254371
Total [baseline] (11.205 s) : 0, 11204751
Agent [candidate] (1.25 s) : 0, 1249890
Total [candidate] (11.147 s) : 0, 11146810
section iast
Agent [baseline] (1.231 s) : 0, 1230731
Total [baseline] (11.388 s) : 0, 11387940
Agent [candidate] (1.225 s) : 0, 1224540
Total [candidate] (11.271 s) : 0, 11271139
section profiling
Agent [baseline] (1.187 s) : 0, 1187069
Total [baseline] (11.071 s) : 0, 11070563
Agent [candidate] (1.188 s) : 0, 1187793
Total [candidate] (10.994 s) : 0, 10994337
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.059 s -
Agent appsec 1.254 s 195.582 ms (18.5%)
Agent iast 1.231 s 171.942 ms (16.2%)
Agent profiling 1.187 s 128.28 ms (12.1%)
Total tracing 11.023 s -
Total appsec 11.205 s 181.586 ms (1.6%)
Total iast 11.388 s 364.775 ms (3.3%)
Total profiling 11.071 s 47.398 ms (0.4%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.06 s -
Agent appsec 1.25 s 189.442 ms (17.9%)
Agent iast 1.225 s 164.092 ms (15.5%)
Agent profiling 1.188 s 127.345 ms (12.0%)
Total tracing 11.084 s -
Total appsec 11.147 s 62.788 ms (0.6%)
Total iast 11.271 s 187.117 ms (1.7%)
Total profiling 10.994 s -89.685 ms (-0.8%)
gantt
    title petclinic - break down per module: candidate=1.61.0-SNAPSHOT~a3832a0fc0, baseline=1.61.0-SNAPSHOT~c1e9ac6389

    dateFormat X
    axisFormat %s
section tracing
crashtracking [baseline] (1.211 ms) : 0, 1211
crashtracking [candidate] (1.198 ms) : 0, 1198
BytebuddyAgent [baseline] (627.546 ms) : 0, 627546
BytebuddyAgent [candidate] (628.762 ms) : 0, 628762
AgentMeter [baseline] (29.136 ms) : 0, 29136
AgentMeter [candidate] (29.296 ms) : 0, 29296
GlobalTracer [baseline] (256.69 ms) : 0, 256690
GlobalTracer [candidate] (257.352 ms) : 0, 257352
AppSec [baseline] (31.436 ms) : 0, 31436
AppSec [candidate] (31.607 ms) : 0, 31607
Debugger [baseline] (59.375 ms) : 0, 59375
Debugger [candidate] (59.587 ms) : 0, 59587
Remote Config [baseline] (593.37 µs) : 0, 593
Remote Config [candidate] (586.494 µs) : 0, 586
Telemetry [baseline] (8.693 ms) : 0, 8693
Telemetry [candidate] (8.647 ms) : 0, 8647
Flare Poller [baseline] (8.032 ms) : 0, 8032
Flare Poller [candidate] (7.343 ms) : 0, 7343
section appsec
crashtracking [baseline] (1.207 ms) : 0, 1207
crashtracking [candidate] (1.199 ms) : 0, 1199
BytebuddyAgent [baseline] (662.677 ms) : 0, 662677
BytebuddyAgent [candidate] (659.676 ms) : 0, 659676
AgentMeter [baseline] (12.128 ms) : 0, 12128
AgentMeter [candidate] (12.08 ms) : 0, 12080
GlobalTracer [baseline] (259.917 ms) : 0, 259917
GlobalTracer [candidate] (259.057 ms) : 0, 259057
AppSec [baseline] (178.32 ms) : 0, 178320
AppSec [candidate] (178.34 ms) : 0, 178340
Debugger [baseline] (66.115 ms) : 0, 66115
Debugger [candidate] (65.17 ms) : 0, 65170
Remote Config [baseline] (578.284 µs) : 0, 578
Remote Config [candidate] (562.886 µs) : 0, 563
Telemetry [baseline] (9.259 ms) : 0, 9259
Telemetry [candidate] (9.895 ms) : 0, 9895
Flare Poller [baseline] (3.637 ms) : 0, 3637
Flare Poller [candidate] (3.567 ms) : 0, 3567
IAST [baseline] (24.106 ms) : 0, 24106
IAST [candidate] (23.98 ms) : 0, 23980
section iast
crashtracking [baseline] (1.219 ms) : 0, 1219
crashtracking [candidate] (1.185 ms) : 0, 1185
BytebuddyAgent [baseline] (798.683 ms) : 0, 798683
BytebuddyAgent [candidate] (794.066 ms) : 0, 794066
AgentMeter [baseline] (11.357 ms) : 0, 11357
AgentMeter [candidate] (11.373 ms) : 0, 11373
GlobalTracer [baseline] (247.866 ms) : 0, 247866
GlobalTracer [candidate] (246.671 ms) : 0, 246671
AppSec [baseline] (26.455 ms) : 0, 26455
AppSec [candidate] (26.402 ms) : 0, 26402
Debugger [baseline] (64.802 ms) : 0, 64802
Debugger [candidate] (65.345 ms) : 0, 65345
Remote Config [baseline] (529.944 µs) : 0, 530
Remote Config [candidate] (520.709 µs) : 0, 521
Telemetry [baseline] (14.554 ms) : 0, 14554
Telemetry [candidate] (13.849 ms) : 0, 13849
Flare Poller [baseline] (4.023 ms) : 0, 4023
Flare Poller [candidate] (3.864 ms) : 0, 3864
IAST [baseline] (25.182 ms) : 0, 25182
IAST [candidate] (25.066 ms) : 0, 25066
section profiling
ProfilingAgent [baseline] (94.053 ms) : 0, 94053
ProfilingAgent [candidate] (94.202 ms) : 0, 94202
crashtracking [baseline] (1.172 ms) : 0, 1172
crashtracking [candidate] (1.181 ms) : 0, 1181
BytebuddyAgent [baseline] (685.71 ms) : 0, 685710
BytebuddyAgent [candidate] (685.694 ms) : 0, 685694
AgentMeter [baseline] (8.648 ms) : 0, 8648
AgentMeter [candidate] (8.685 ms) : 0, 8685
GlobalTracer [baseline] (216.515 ms) : 0, 216515
GlobalTracer [candidate] (216.515 ms) : 0, 216515
AppSec [baseline] (32.031 ms) : 0, 32031
AppSec [candidate] (32.233 ms) : 0, 32233
Debugger [baseline] (65.025 ms) : 0, 65025
Debugger [candidate] (63.4 ms) : 0, 63400
Remote Config [baseline] (594.169 µs) : 0, 594
Remote Config [candidate] (581.658 µs) : 0, 582
Telemetry [baseline] (8.992 ms) : 0, 8992
Telemetry [candidate] (10.632 ms) : 0, 10632
Flare Poller [baseline] (3.48 ms) : 0, 3480
Flare Poller [candidate] (3.539 ms) : 0, 3539
Profiling [baseline] (94.637 ms) : 0, 94637
Profiling [candidate] (94.774 ms) : 0, 94774
Loading
Startup time reports for insecure-bank
gantt
    title insecure-bank - global startup overhead: candidate=1.61.0-SNAPSHOT~a3832a0fc0, baseline=1.61.0-SNAPSHOT~c1e9ac6389

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.058 s) : 0, 1058412
Total [baseline] (8.878 s) : 0, 8878412
Agent [candidate] (1.058 s) : 0, 1058102
Total [candidate] (8.842 s) : 0, 8841984
section iast
Agent [baseline] (1.237 s) : 0, 1237048
Total [baseline] (9.589 s) : 0, 9589228
Agent [candidate] (1.225 s) : 0, 1225140
Total [candidate] (9.548 s) : 0, 9548283
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.058 s -
Agent iast 1.237 s 178.636 ms (16.9%)
Total tracing 8.878 s -
Total iast 9.589 s 710.815 ms (8.0%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.058 s -
Agent iast 1.225 s 167.038 ms (15.8%)
Total tracing 8.842 s -
Total iast 9.548 s 706.299 ms (8.0%)
gantt
    title insecure-bank - break down per module: candidate=1.61.0-SNAPSHOT~a3832a0fc0, baseline=1.61.0-SNAPSHOT~c1e9ac6389

    dateFormat X
    axisFormat %s
section tracing
crashtracking [baseline] (1.221 ms) : 0, 1221
crashtracking [candidate] (1.191 ms) : 0, 1191
BytebuddyAgent [baseline] (628.006 ms) : 0, 628006
BytebuddyAgent [candidate] (628.283 ms) : 0, 628283
AgentMeter [baseline] (29.128 ms) : 0, 29128
AgentMeter [candidate] (29.173 ms) : 0, 29173
GlobalTracer [baseline] (257.141 ms) : 0, 257141
GlobalTracer [candidate] (256.656 ms) : 0, 256656
AppSec [baseline] (31.555 ms) : 0, 31555
AppSec [candidate] (31.592 ms) : 0, 31592
Debugger [baseline] (58.824 ms) : 0, 58824
Debugger [candidate] (58.69 ms) : 0, 58690
Remote Config [baseline] (596.841 µs) : 0, 597
Remote Config [candidate] (586.894 µs) : 0, 587
Telemetry [baseline] (8.656 ms) : 0, 8656
Telemetry [candidate] (8.677 ms) : 0, 8677
Flare Poller [baseline] (7.133 ms) : 0, 7133
Flare Poller [candidate] (7.116 ms) : 0, 7116
section iast
crashtracking [baseline] (1.234 ms) : 0, 1234
crashtracking [candidate] (1.197 ms) : 0, 1197
BytebuddyAgent [baseline] (803.492 ms) : 0, 803492
BytebuddyAgent [candidate] (795.67 ms) : 0, 795670
AgentMeter [baseline] (11.601 ms) : 0, 11601
AgentMeter [candidate] (11.295 ms) : 0, 11295
GlobalTracer [baseline] (249.24 ms) : 0, 249240
GlobalTracer [candidate] (247.062 ms) : 0, 247062
AppSec [baseline] (27.456 ms) : 0, 27456
AppSec [candidate] (26.245 ms) : 0, 26245
Debugger [baseline] (61.976 ms) : 0, 61976
Debugger [candidate] (62.343 ms) : 0, 62343
Remote Config [baseline] (521.429 µs) : 0, 521
Remote Config [candidate] (529.902 µs) : 0, 530
Telemetry [baseline] (14.984 ms) : 0, 14984
Telemetry [candidate] (14.961 ms) : 0, 14961
Flare Poller [baseline] (4.654 ms) : 0, 4654
Flare Poller [candidate] (4.652 ms) : 0, 4652
IAST [baseline] (25.326 ms) : 0, 25326
IAST [candidate] (25.094 ms) : 0, 25094
Loading

Load

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master bdu/report-grpc-status-code-to-tracer-client-computed-stats
git_commit_date 1773300530 1773309778
git_commit_sha c1e9ac6 a3832a0
release_version 1.61.0-SNAPSHOT~c1e9ac6389 1.61.0-SNAPSHOT~a3832a0fc0
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1773312216 1773312216
ci_job_id 1499636916 1499636916
ci_pipeline_id 102086432 102086432
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-zfyrx7zua-project-304-concurrent-2-t69n6din 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-zfyrx7zua-project-304-concurrent-2-t69n6din 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

Summary

Found 2 performance improvements and 3 performance regressions! Performance is the same for 15 metrics, 16 unstable metrics.

scenario Δ mean agg_http_req_duration_p50 Δ mean agg_http_req_duration_p95 Δ mean throughput candidate mean agg_http_req_duration_p50 candidate mean agg_http_req_duration_p95 candidate mean throughput baseline mean agg_http_req_duration_p50 baseline mean agg_http_req_duration_p95 baseline mean throughput
scenario:load:insecure-bank:iast_GLOBAL:high_load better
[-328.842µs; -231.046µs] or [-11.467%; -8.057%]
better
[-743.480µs; -369.148µs] or [-9.286%; -4.610%]
unstable
[-21.164op/s; +246.539op/s] or [-1.670%; +19.448%]
2.588ms 7.450ms 1380.375op/s 2.868ms 8.007ms 1267.688op/s
scenario:load:petclinic:tracing:high_load worse
[+0.546ms; +1.466ms] or [+3.077%; +8.263%]
unsure
[+0.488ms; +1.840ms] or [+1.676%; +6.313%]
unstable
[-35.428op/s; +11.740op/s] or [-13.738%; +4.553%]
18.754ms 30.308ms 246.031op/s 17.748ms 29.144ms 257.875op/s
scenario:load:petclinic:iast:high_load worse
[+425.396µs; +737.843µs] or [+2.455%; +4.257%]
worse
[+0.590ms; +1.702ms] or [+2.074%; +5.986%]
unstable
[-33.802op/s; +13.802op/s] or [-12.775%; +5.216%]
17.912ms 29.579ms 254.594op/s 17.330ms 28.434ms 264.594op/s
Request duration reports for insecure-bank
gantt
    title insecure-bank - request duration [CI 0.99] : candidate=1.61.0-SNAPSHOT~a3832a0fc0, baseline=1.61.0-SNAPSHOT~c1e9ac6389
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.179 ms) : 1168, 1191
.   : milestone, 1179,
iast (3.112 ms) : 3072, 3152
.   : milestone, 3112,
iast_FULL (5.884 ms) : 5825, 5943
.   : milestone, 5884,
iast_GLOBAL (3.618 ms) : 3562, 3673
.   : milestone, 3618,
profiling (2.144 ms) : 2123, 2165
.   : milestone, 2144,
tracing (1.787 ms) : 1773, 1802
.   : milestone, 1787,
section candidate
no_agent (1.19 ms) : 1178, 1201
.   : milestone, 1190,
iast (2.997 ms) : 2958, 3035
.   : milestone, 2997,
iast_FULL (5.737 ms) : 5680, 5795
.   : milestone, 5737,
iast_GLOBAL (3.317 ms) : 3267, 3367
.   : milestone, 3317,
profiling (2.02 ms) : 2000, 2040
.   : milestone, 2020,
tracing (1.741 ms) : 1727, 1754
.   : milestone, 1741,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 1.179 ms [1.168 ms, 1.191 ms] -
iast 3.112 ms [3.072 ms, 3.152 ms] 1.933 ms (163.9%)
iast_FULL 5.884 ms [5.825 ms, 5.943 ms] 4.704 ms (398.9%)
iast_GLOBAL 3.618 ms [3.562 ms, 3.673 ms] 2.438 ms (206.8%)
profiling 2.144 ms [2.123 ms, 2.165 ms] 964.724 µs (81.8%)
tracing 1.787 ms [1.773 ms, 1.802 ms] 608.092 µs (51.6%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 1.19 ms [1.178 ms, 1.201 ms] -
iast 2.997 ms [2.958 ms, 3.035 ms] 1.807 ms (151.9%)
iast_FULL 5.737 ms [5.68 ms, 5.795 ms] 4.547 ms (382.2%)
iast_GLOBAL 3.317 ms [3.267 ms, 3.367 ms] 2.127 ms (178.8%)
profiling 2.02 ms [2.0 ms, 2.04 ms] 830.157 µs (69.8%)
tracing 1.741 ms [1.727 ms, 1.754 ms] 550.839 µs (46.3%)
Request duration reports for petclinic
gantt
    title petclinic - request duration [CI 0.99] : candidate=1.61.0-SNAPSHOT~a3832a0fc0, baseline=1.61.0-SNAPSHOT~c1e9ac6389
    dateFormat X
    axisFormat %s
section baseline
no_agent (17.959 ms) : 17774, 18144
.   : milestone, 17959,
appsec (18.849 ms) : 18656, 19041
.   : milestone, 18849,
code_origins (17.832 ms) : 17653, 18010
.   : milestone, 17832,
iast (17.635 ms) : 17459, 17811
.   : milestone, 17635,
profiling (19.913 ms) : 19707, 20119
.   : milestone, 19913,
tracing (18.097 ms) : 17916, 18277
.   : milestone, 18097,
section candidate
no_agent (18.181 ms) : 17995, 18366
.   : milestone, 18181,
appsec (18.718 ms) : 18531, 18906
.   : milestone, 18718,
code_origins (17.778 ms) : 17602, 17953
.   : milestone, 17778,
iast (18.331 ms) : 18147, 18515
.   : milestone, 18331,
profiling (19.475 ms) : 19279, 19671
.   : milestone, 19475,
tracing (18.973 ms) : 18781, 19165
.   : milestone, 18973,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 17.959 ms [17.774 ms, 18.144 ms] -
appsec 18.849 ms [18.656 ms, 19.041 ms] 889.73 µs (5.0%)
code_origins 17.832 ms [17.653 ms, 18.01 ms] -126.845 µs (-0.7%)
iast 17.635 ms [17.459 ms, 17.811 ms] -323.63 µs (-1.8%)
profiling 19.913 ms [19.707 ms, 20.119 ms] 1.954 ms (10.9%)
tracing 18.097 ms [17.916 ms, 18.277 ms] 137.868 µs (0.8%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 18.181 ms [17.995 ms, 18.366 ms] -
appsec 18.718 ms [18.531 ms, 18.906 ms] 537.636 µs (3.0%)
code_origins 17.778 ms [17.602 ms, 17.953 ms] -403.118 µs (-2.2%)
iast 18.331 ms [18.147 ms, 18.515 ms] 149.991 µs (0.8%)
profiling 19.475 ms [19.279 ms, 19.671 ms] 1.294 ms (7.1%)
tracing 18.973 ms [18.781 ms, 19.165 ms] 792.073 µs (4.4%)

Dacapo

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master bdu/report-grpc-status-code-to-tracer-client-computed-stats
git_commit_date 1773300530 1773309778
git_commit_sha c1e9ac6 a3832a0
release_version 1.61.0-SNAPSHOT~c1e9ac6389 1.61.0-SNAPSHOT~a3832a0fc0
See matching parameters
Baseline Candidate
application biojava biojava
ci_job_date 1773311881 1773311881
ci_job_id 1499636918 1499636918
ci_pipeline_id 102086432 102086432
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-zfyrx7zua-project-304-concurrent-0-viv0k5wv 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-zfyrx7zua-project-304-concurrent-0-viv0k5wv 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

Summary

Found 0 performance improvements and 1 performance regressions! Performance is the same for 10 metrics, 1 unstable metrics.

scenario Δ mean execution_time candidate mean execution_time baseline mean execution_time
scenario:dacapo:tomcat:tracing worse
[+42.043µs; +151.796µs] or [+2.134%; +7.703%]
2.068ms 1.971ms
Execution time for biojava
gantt
    title biojava - execution time [CI 0.99] : candidate=1.61.0-SNAPSHOT~a3832a0fc0, baseline=1.61.0-SNAPSHOT~c1e9ac6389
    dateFormat X
    axisFormat %s
section baseline
no_agent (15.487 s) : 15487000, 15487000
.   : milestone, 15487000,
appsec (15.087 s) : 15087000, 15087000
.   : milestone, 15087000,
iast (18.106 s) : 18106000, 18106000
.   : milestone, 18106000,
iast_GLOBAL (17.882 s) : 17882000, 17882000
.   : milestone, 17882000,
profiling (15.681 s) : 15681000, 15681000
.   : milestone, 15681000,
tracing (15.258 s) : 15258000, 15258000
.   : milestone, 15258000,
section candidate
no_agent (15.438 s) : 15438000, 15438000
.   : milestone, 15438000,
appsec (15.156 s) : 15156000, 15156000
.   : milestone, 15156000,
iast (18.182 s) : 18182000, 18182000
.   : milestone, 18182000,
iast_GLOBAL (17.755 s) : 17755000, 17755000
.   : milestone, 17755000,
profiling (14.599 s) : 14599000, 14599000
.   : milestone, 14599000,
tracing (15.147 s) : 15147000, 15147000
.   : milestone, 15147000,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 15.487 s [15.487 s, 15.487 s] -
appsec 15.087 s [15.087 s, 15.087 s] -400.0 ms (-2.6%)
iast 18.106 s [18.106 s, 18.106 s] 2.619 s (16.9%)
iast_GLOBAL 17.882 s [17.882 s, 17.882 s] 2.395 s (15.5%)
profiling 15.681 s [15.681 s, 15.681 s] 194.0 ms (1.3%)
tracing 15.258 s [15.258 s, 15.258 s] -229.0 ms (-1.5%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 15.438 s [15.438 s, 15.438 s] -
appsec 15.156 s [15.156 s, 15.156 s] -282.0 ms (-1.8%)
iast 18.182 s [18.182 s, 18.182 s] 2.744 s (17.8%)
iast_GLOBAL 17.755 s [17.755 s, 17.755 s] 2.317 s (15.0%)
profiling 14.599 s [14.599 s, 14.599 s] -839.0 ms (-5.4%)
tracing 15.147 s [15.147 s, 15.147 s] -291.0 ms (-1.9%)
Execution time for tomcat
gantt
    title tomcat - execution time [CI 0.99] : candidate=1.61.0-SNAPSHOT~a3832a0fc0, baseline=1.61.0-SNAPSHOT~c1e9ac6389
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.448 ms) : 1436, 1459
.   : milestone, 1448,
appsec (2.518 ms) : 2462, 2573
.   : milestone, 2518,
iast (2.249 ms) : 2180, 2319
.   : milestone, 2249,
iast_GLOBAL (2.293 ms) : 2223, 2363
.   : milestone, 2293,
profiling (2.111 ms) : 2055, 2168
.   : milestone, 2111,
tracing (1.971 ms) : 1923, 2019
.   : milestone, 1971,
section candidate
no_agent (1.477 ms) : 1465, 1488
.   : milestone, 1477,
appsec (3.757 ms) : 3540, 3975
.   : milestone, 3757,
iast (2.262 ms) : 2193, 2332
.   : milestone, 2262,
iast_GLOBAL (2.299 ms) : 2229, 2369
.   : milestone, 2299,
profiling (2.112 ms) : 2056, 2169
.   : milestone, 2112,
tracing (2.068 ms) : 2014, 2121
.   : milestone, 2068,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.448 ms [1.436 ms, 1.459 ms] -
appsec 2.518 ms [2.462 ms, 2.573 ms] 1.07 ms (73.9%)
iast 2.249 ms [2.18 ms, 2.319 ms] 801.768 µs (55.4%)
iast_GLOBAL 2.293 ms [2.223 ms, 2.363 ms] 845.626 µs (58.4%)
profiling 2.111 ms [2.055 ms, 2.168 ms] 663.679 µs (45.8%)
tracing 1.971 ms [1.923 ms, 2.019 ms] 523.099 µs (36.1%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.477 ms [1.465 ms, 1.488 ms] -
appsec 3.757 ms [3.54 ms, 3.975 ms] 2.281 ms (154.5%)
iast 2.262 ms [2.193 ms, 2.332 ms] 785.52 µs (53.2%)
iast_GLOBAL 2.299 ms [2.229 ms, 2.369 ms] 822.564 µs (55.7%)
profiling 2.112 ms [2.056 ms, 2.169 ms] 635.776 µs (43.1%)
tracing 2.068 ms [2.014 ms, 2.121 ms] 590.827 µs (40.0%)

@bric3 bric3 added inst: grpc gRPC instrumentation inst: armeria Armeria Instrumentation labels Mar 11, 2026
@bric3 bric3 changed the title Reports gRPC status code in CCS Report gRPC status code in client-computed stats Mar 11, 2026
@bric3 bric3 force-pushed the bdu/report-grpc-status-code-to-tracer-client-computed-stats branch from 21ec5e9 to 9f3f544 Compare March 12, 2026 09:52
bric3 added 2 commits March 12, 2026 11:02
# Conflicts:
#	dd-trace-core/src/main/java/datadog/trace/common/metrics/MetricKey.java
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`.
@bric3 bric3 force-pushed the bdu/report-grpc-status-code-to-tracer-client-computed-stats branch from 9f3f544 to a3832a0 Compare March 12, 2026 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: metrics Metrics inst: armeria Armeria Instrumentation inst: grpc gRPC instrumentation type: bug Bug report and fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants