Skip to content

Add peer tags, span kind and trace root flag to MetricKey bucket #9178

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

bric3
Copy link
Contributor

@bric3 bric3 commented Jul 15, 2025

What Does This Do

This fills the gap regarding peer tags, by declaring the in the MetricKey.

Motivation

Additional Notes

Contributor Checklist

Jira ticket: [PROJ-IDENT]

@bric3 bric3 requested a review from amarziali July 15, 2025 17:07
@pr-commenter
Copy link

pr-commenter bot commented Jul 15, 2025

Benchmarks

Startup

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master bdu/add-missing-attributes-in-metrics-key
git_commit_date 1754940144 1754980335
git_commit_sha a3836e6 318a10e
release_version 1.53.0-SNAPSHOT~a3836e611d 1.53.0-SNAPSHOT~318a10eb4d
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1754982172 1754982172
ci_job_id 1075382862 1075382862
ci_pipeline_id 73373558 73373558
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-lvfv8vxr 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-lvfv8vxr 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 47 metrics, 12 unstable metrics.

Startup time reports for insecure-bank
gantt
    title insecure-bank - global startup overhead: candidate=1.53.0-SNAPSHOT~318a10eb4d, baseline=1.53.0-SNAPSHOT~a3836e611d

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.042 s) : 0, 1041604
Total [baseline] (8.544 s) : 0, 8543794
Agent [candidate] (1.044 s) : 0, 1043933
Total [candidate] (8.571 s) : 0, 8570735
section iast
Agent [baseline] (1.173 s) : 0, 1173219
Total [baseline] (9.331 s) : 0, 9331491
Agent [candidate] (1.179 s) : 0, 1178656
Total [candidate] (9.31 s) : 0, 9310282
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.042 s -
Agent iast 1.173 s 131.615 ms (12.6%)
Total tracing 8.544 s -
Total iast 9.331 s 787.697 ms (9.2%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.044 s -
Agent iast 1.179 s 134.723 ms (12.9%)
Total tracing 8.571 s -
Total iast 9.31 s 739.547 ms (8.6%)
gantt
    title insecure-bank - break down per module: candidate=1.53.0-SNAPSHOT~318a10eb4d, baseline=1.53.0-SNAPSHOT~a3836e611d

    dateFormat X
    axisFormat %s
section tracing
crashtracking [baseline] (1.418 ms) : 0, 1418
crashtracking [candidate] (1.428 ms) : 0, 1428
BytebuddyAgent [baseline] (729.162 ms) : 0, 729162
BytebuddyAgent [candidate] (732.349 ms) : 0, 732349
GlobalTracer [baseline] (241.03 ms) : 0, 241030
GlobalTracer [candidate] (241.898 ms) : 0, 241898
AppSec [baseline] (29.868 ms) : 0, 29868
AppSec [candidate] (30.028 ms) : 0, 30028
Debugger [baseline] (5.976 ms) : 0, 5976
Debugger [candidate] (6.018 ms) : 0, 6018
Remote Config [baseline] (643.299 µs) : 0, 643
Remote Config [candidate] (642.534 µs) : 0, 643
Telemetry [baseline] (12.652 ms) : 0, 12652
Telemetry [candidate] (10.647 ms) : 0, 10647
section iast
crashtracking [baseline] (1.428 ms) : 0, 1428
crashtracking [candidate] (1.417 ms) : 0, 1417
BytebuddyAgent [baseline] (847.607 ms) : 0, 847607
BytebuddyAgent [candidate] (850.617 ms) : 0, 850617
GlobalTracer [baseline] (231.955 ms) : 0, 231955
GlobalTracer [candidate] (233.164 ms) : 0, 233164
IAST [baseline] (31.357 ms) : 0, 31357
IAST [candidate] (28.402 ms) : 0, 28402
AppSec [baseline] (25.535 ms) : 0, 25535
AppSec [candidate] (26.876 ms) : 0, 26876
Debugger [baseline] (5.716 ms) : 0, 5716
Debugger [candidate] (8.389 ms) : 0, 8389
Remote Config [baseline] (574.877 µs) : 0, 575
Remote Config [candidate] (591.266 µs) : 0, 591
Telemetry [baseline] (8.219 ms) : 0, 8219
Telemetry [candidate] (8.319 ms) : 0, 8319
Loading
Startup time reports for petclinic
gantt
    title petclinic - global startup overhead: candidate=1.53.0-SNAPSHOT~318a10eb4d, baseline=1.53.0-SNAPSHOT~a3836e611d

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.043 s) : 0, 1043416
Total [baseline] (10.687 s) : 0, 10687208
Agent [candidate] (1.053 s) : 0, 1053026
Total [candidate] (10.787 s) : 0, 10787381
section appsec
Agent [baseline] (1.227 s) : 0, 1227055
Total [baseline] (10.828 s) : 0, 10827506
Agent [candidate] (1.219 s) : 0, 1218574
Total [candidate] (10.813 s) : 0, 10812808
section iast
Agent [baseline] (1.174 s) : 0, 1173732
Total [baseline] (10.859 s) : 0, 10858611
Agent [candidate] (1.177 s) : 0, 1177006
Total [candidate] (10.991 s) : 0, 10991032
section profiling
Agent [baseline] (1.193 s) : 0, 1192616
Total [baseline] (10.839 s) : 0, 10839489
Agent [candidate] (1.2 s) : 0, 1200485
Total [candidate] (10.862 s) : 0, 10861915
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.043 s -
Agent appsec 1.227 s 183.639 ms (17.6%)
Agent iast 1.174 s 130.316 ms (12.5%)
Agent profiling 1.193 s 149.2 ms (14.3%)
Total tracing 10.687 s -
Total appsec 10.828 s 140.297 ms (1.3%)
Total iast 10.859 s 171.402 ms (1.6%)
Total profiling 10.839 s 152.281 ms (1.4%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.053 s -
Agent appsec 1.219 s 165.547 ms (15.7%)
Agent iast 1.177 s 123.98 ms (11.8%)
Agent profiling 1.2 s 147.459 ms (14.0%)
Total tracing 10.787 s -
Total appsec 10.813 s 25.426 ms (0.2%)
Total iast 10.991 s 203.651 ms (1.9%)
Total profiling 10.862 s 74.534 ms (0.7%)
gantt
    title petclinic - break down per module: candidate=1.53.0-SNAPSHOT~318a10eb4d, baseline=1.53.0-SNAPSHOT~a3836e611d

    dateFormat X
    axisFormat %s
section tracing
crashtracking [baseline] (1.433 ms) : 0, 1433
crashtracking [candidate] (1.441 ms) : 0, 1441
BytebuddyAgent [baseline] (730.967 ms) : 0, 730967
BytebuddyAgent [candidate] (737.014 ms) : 0, 737014
GlobalTracer [baseline] (241.444 ms) : 0, 241444
GlobalTracer [candidate] (243.943 ms) : 0, 243943
AppSec [baseline] (29.93 ms) : 0, 29930
AppSec [candidate] (30.574 ms) : 0, 30574
Debugger [baseline] (6.004 ms) : 0, 6004
Debugger [candidate] (6.098 ms) : 0, 6098
Remote Config [baseline] (648.761 µs) : 0, 649
Remote Config [candidate] (663.014 µs) : 0, 663
Telemetry [baseline] (12.065 ms) : 0, 12065
Telemetry [candidate] (12.18 ms) : 0, 12180
section appsec
crashtracking [baseline] (1.444 ms) : 0, 1444
crashtracking [candidate] (1.427 ms) : 0, 1427
BytebuddyAgent [baseline] (758.306 ms) : 0, 758306
BytebuddyAgent [candidate] (753.051 ms) : 0, 753051
GlobalTracer [baseline] (236.305 ms) : 0, 236305
GlobalTracer [candidate] (234.642 ms) : 0, 234642
IAST [baseline] (23.726 ms) : 0, 23726
IAST [candidate] (23.411 ms) : 0, 23411
AppSec [baseline] (169.026 ms) : 0, 169026
AppSec [candidate] (168.835 ms) : 0, 168835
Debugger [baseline] (8.032 ms) : 0, 8032
Debugger [candidate] (7.221 ms) : 0, 7221
Remote Config [baseline] (635.005 µs) : 0, 635
Remote Config [candidate] (628.911 µs) : 0, 629
Telemetry [baseline] (8.413 ms) : 0, 8413
Telemetry [candidate] (8.348 ms) : 0, 8348
section iast
crashtracking [baseline] (1.426 ms) : 0, 1426
crashtracking [candidate] (1.423 ms) : 0, 1423
BytebuddyAgent [baseline] (846.951 ms) : 0, 846951
BytebuddyAgent [candidate] (849.211 ms) : 0, 849211
GlobalTracer [baseline] (232.438 ms) : 0, 232438
GlobalTracer [candidate] (233.182 ms) : 0, 233182
IAST [baseline] (28.41 ms) : 0, 28410
IAST [candidate] (29.277 ms) : 0, 29277
AppSec [baseline] (27.293 ms) : 0, 27293
AppSec [candidate] (28.261 ms) : 0, 28261
Debugger [baseline] (7.433 ms) : 0, 7433
Debugger [candidate] (5.782 ms) : 0, 5782
Remote Config [baseline] (582.147 µs) : 0, 582
Remote Config [candidate] (578.341 µs) : 0, 578
Telemetry [baseline] (8.249 ms) : 0, 8249
Telemetry [candidate] (8.288 ms) : 0, 8288
section profiling
crashtracking [baseline] (1.39 ms) : 0, 1390
crashtracking [candidate] (1.423 ms) : 0, 1423
BytebuddyAgent [baseline] (759.639 ms) : 0, 759639
BytebuddyAgent [candidate] (766.174 ms) : 0, 766174
GlobalTracer [baseline] (221.912 ms) : 0, 221912
GlobalTracer [candidate] (222.59 ms) : 0, 222590
AppSec [baseline] (29.867 ms) : 0, 29867
AppSec [candidate] (30.187 ms) : 0, 30187
Debugger [baseline] (6.239 ms) : 0, 6239
Debugger [candidate] (6.319 ms) : 0, 6319
Remote Config [baseline] (710.076 µs) : 0, 710
Remote Config [candidate] (672.998 µs) : 0, 673
Telemetry [baseline] (16.183 ms) : 0, 16183
Telemetry [candidate] (15.313 ms) : 0, 15313
ProfilingAgent [baseline] (107.231 ms) : 0, 107231
ProfilingAgent [candidate] (107.982 ms) : 0, 107982
Profiling [baseline] (107.874 ms) : 0, 107874
Profiling [candidate] (108.62 ms) : 0, 108620
Loading

Load

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master bdu/add-missing-attributes-in-metrics-key
git_commit_date 1754940144 1754980335
git_commit_sha a3836e6 318a10e
release_version 1.53.0-SNAPSHOT~a3836e611d 1.53.0-SNAPSHOT~318a10eb4d
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1754981852 1754981852
ci_job_id 1075382863 1075382863
ci_pipeline_id 73373558 73373558
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-9mzyq07d 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-9mzyq07d 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 1 performance improvements and 2 performance regressions! Performance is the same for 9 metrics, 12 unstable metrics.

scenario Δ mean http_req_duration Δ mean throughput candidate mean http_req_duration candidate mean throughput baseline mean http_req_duration baseline mean throughput
scenario:load:petclinic:no_agent:high_load worse
[+1.894ms; +2.518ms] or [+5.345%; +7.109%]
unstable
[-16.181op/s; +0.806op/s] or [-12.263%; +0.611%]
37.630ms 124.263op/s 35.424ms 131.950op/s
scenario:load:petclinic:tracing:high_load worse
[+1.793ms; +2.613ms] or [+4.142%; +6.037%]
unstable
[-12.365op/s; +1.865op/s] or [-11.436%; +1.725%]
45.483ms 102.875op/s 43.280ms 108.125op/s
scenario:load:petclinic:profiling:high_load better
[-2.011ms; -1.006ms] or [-4.146%; -2.074%]
unstable
[-3.991op/s; +10.091op/s] or [-4.132%; +10.448%]
47.006ms 99.625op/s 48.515ms 96.575op/s
Request duration reports for insecure-bank
gantt
    title insecure-bank - request duration [CI 0.99] : candidate=1.53.0-SNAPSHOT~318a10eb4d, baseline=1.53.0-SNAPSHOT~a3836e611d
    dateFormat X
    axisFormat %s
section baseline
no_agent (4.404 ms) : 4354, 4454
.   : milestone, 4404,
iast (9.341 ms) : 9183, 9499
.   : milestone, 9341,
iast_FULL (13.827 ms) : 13556, 14098
.   : milestone, 13827,
iast_GLOBAL (10.343 ms) : 10160, 10526
.   : milestone, 10343,
profiling (8.446 ms) : 8306, 8587
.   : milestone, 8446,
tracing (7.626 ms) : 7513, 7739
.   : milestone, 7626,
section candidate
no_agent (4.382 ms) : 4332, 4432
.   : milestone, 4382,
iast (9.279 ms) : 9128, 9429
.   : milestone, 9279,
iast_FULL (13.657 ms) : 13388, 13925
.   : milestone, 13657,
iast_GLOBAL (10.686 ms) : 10496, 10876
.   : milestone, 10686,
profiling (8.589 ms) : 8460, 8718
.   : milestone, 8589,
tracing (7.455 ms) : 7351, 7559
.   : milestone, 7455,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 4.404 ms [4.354 ms, 4.454 ms] -
iast 9.341 ms [9.183 ms, 9.499 ms] 4.937 ms (112.1%)
iast_FULL 13.827 ms [13.556 ms, 14.098 ms] 9.423 ms (214.0%)
iast_GLOBAL 10.343 ms [10.16 ms, 10.526 ms] 5.939 ms (134.9%)
profiling 8.446 ms [8.306 ms, 8.587 ms] 4.043 ms (91.8%)
tracing 7.626 ms [7.513 ms, 7.739 ms] 3.222 ms (73.2%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 4.382 ms [4.332 ms, 4.432 ms] -
iast 9.279 ms [9.128 ms, 9.429 ms] 4.896 ms (111.7%)
iast_FULL 13.657 ms [13.388 ms, 13.925 ms] 9.275 ms (211.6%)
iast_GLOBAL 10.686 ms [10.496 ms, 10.876 ms] 6.304 ms (143.8%)
profiling 8.589 ms [8.46 ms, 8.718 ms] 4.207 ms (96.0%)
tracing 7.455 ms [7.351 ms, 7.559 ms] 3.073 ms (70.1%)
Request duration reports for petclinic
gantt
    title petclinic - request duration [CI 0.99] : candidate=1.53.0-SNAPSHOT~318a10eb4d, baseline=1.53.0-SNAPSHOT~a3836e611d
    dateFormat X
    axisFormat %s
section baseline
no_agent (35.424 ms) : 35144, 35704
.   : milestone, 35424,
appsec (47.082 ms) : 46662, 47501
.   : milestone, 47082,
code_origins (45.423 ms) : 45034, 45813
.   : milestone, 45423,
iast (45.764 ms) : 45367, 46160
.   : milestone, 45764,
profiling (48.515 ms) : 48039, 48992
.   : milestone, 48515,
tracing (43.28 ms) : 42908, 43653
.   : milestone, 43280,
section candidate
no_agent (37.63 ms) : 37330, 37931
.   : milestone, 37630,
appsec (47.075 ms) : 46653, 47496
.   : milestone, 47075,
code_origins (44.295 ms) : 43925, 44665
.   : milestone, 44295,
iast (46.012 ms) : 45624, 46401
.   : milestone, 46012,
profiling (47.006 ms) : 46549, 47464
.   : milestone, 47006,
tracing (45.483 ms) : 45094, 45873
.   : milestone, 45483,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 35.424 ms [35.144 ms, 35.704 ms] -
appsec 47.082 ms [46.662 ms, 47.501 ms] 11.658 ms (32.9%)
code_origins 45.423 ms [45.034 ms, 45.813 ms] 9.999 ms (28.2%)
iast 45.764 ms [45.367 ms, 46.16 ms] 10.34 ms (29.2%)
profiling 48.515 ms [48.039 ms, 48.992 ms] 13.091 ms (37.0%)
tracing 43.28 ms [42.908 ms, 43.653 ms] 7.856 ms (22.2%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 37.63 ms [37.33 ms, 37.931 ms] -
appsec 47.075 ms [46.653 ms, 47.496 ms] 9.444 ms (25.1%)
code_origins 44.295 ms [43.925 ms, 44.665 ms] 6.665 ms (17.7%)
iast 46.012 ms [45.624 ms, 46.401 ms] 8.382 ms (22.3%)
profiling 47.006 ms [46.549 ms, 47.464 ms] 9.376 ms (24.9%)
tracing 45.483 ms [45.094 ms, 45.873 ms] 7.853 ms (20.9%)

Dacapo

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master bdu/add-missing-attributes-in-metrics-key
git_commit_date 1754940144 1754980335
git_commit_sha a3836e6 318a10e
release_version 1.53.0-SNAPSHOT~a3836e611d 1.53.0-SNAPSHOT~318a10eb4d
See matching parameters
Baseline Candidate
application biojava biojava
ci_job_date 1754982297 1754982297
ci_job_id 1075382864 1075382864
ci_pipeline_id 73373558 73373558
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-uo36hcqq 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-uo36hcqq 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 0 performance regressions! Performance is the same for 10 metrics, 2 unstable metrics.

Execution time for biojava
gantt
    title biojava - execution time [CI 0.99] : candidate=1.53.0-SNAPSHOT~318a10eb4d, baseline=1.53.0-SNAPSHOT~a3836e611d
    dateFormat X
    axisFormat %s
section baseline
no_agent (15.009 s) : 15009000, 15009000
.   : milestone, 15009000,
appsec (15.051 s) : 15051000, 15051000
.   : milestone, 15051000,
iast (18.95 s) : 18950000, 18950000
.   : milestone, 18950000,
iast_GLOBAL (18.147 s) : 18147000, 18147000
.   : milestone, 18147000,
profiling (15.146 s) : 15146000, 15146000
.   : milestone, 15146000,
tracing (14.997 s) : 14997000, 14997000
.   : milestone, 14997000,
section candidate
no_agent (14.928 s) : 14928000, 14928000
.   : milestone, 14928000,
appsec (14.813 s) : 14813000, 14813000
.   : milestone, 14813000,
iast (18.532 s) : 18532000, 18532000
.   : milestone, 18532000,
iast_GLOBAL (17.934 s) : 17934000, 17934000
.   : milestone, 17934000,
profiling (15.211 s) : 15211000, 15211000
.   : milestone, 15211000,
tracing (15.205 s) : 15205000, 15205000
.   : milestone, 15205000,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 15.009 s [15.009 s, 15.009 s] -
appsec 15.051 s [15.051 s, 15.051 s] 42.0 ms (0.3%)
iast 18.95 s [18.95 s, 18.95 s] 3.941 s (26.3%)
iast_GLOBAL 18.147 s [18.147 s, 18.147 s] 3.138 s (20.9%)
profiling 15.146 s [15.146 s, 15.146 s] 137.0 ms (0.9%)
tracing 14.997 s [14.997 s, 14.997 s] -12.0 ms (-0.1%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 14.928 s [14.928 s, 14.928 s] -
appsec 14.813 s [14.813 s, 14.813 s] -115.0 ms (-0.8%)
iast 18.532 s [18.532 s, 18.532 s] 3.604 s (24.1%)
iast_GLOBAL 17.934 s [17.934 s, 17.934 s] 3.006 s (20.1%)
profiling 15.211 s [15.211 s, 15.211 s] 283.0 ms (1.9%)
tracing 15.205 s [15.205 s, 15.205 s] 277.0 ms (1.9%)
Execution time for tomcat
gantt
    title tomcat - execution time [CI 0.99] : candidate=1.53.0-SNAPSHOT~318a10eb4d, baseline=1.53.0-SNAPSHOT~a3836e611d
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.477 ms) : 1465, 1488
.   : milestone, 1477,
appsec (3.675 ms) : 3453, 3896
.   : milestone, 3675,
iast (2.193 ms) : 2130, 2255
.   : milestone, 2193,
iast_GLOBAL (2.245 ms) : 2182, 2308
.   : milestone, 2245,
profiling (2.481 ms) : 2313, 2649
.   : milestone, 2481,
tracing (2.016 ms) : 1968, 2065
.   : milestone, 2016,
section candidate
no_agent (1.474 ms) : 1463, 1486
.   : milestone, 1474,
appsec (3.65 ms) : 3433, 3867
.   : milestone, 3650,
iast (2.199 ms) : 2136, 2262
.   : milestone, 2199,
iast_GLOBAL (2.245 ms) : 2182, 2309
.   : milestone, 2245,
profiling (2.068 ms) : 2016, 2120
.   : milestone, 2068,
tracing (2.024 ms) : 1975, 2073
.   : milestone, 2024,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.477 ms [1.465 ms, 1.488 ms] -
appsec 3.675 ms [3.453 ms, 3.896 ms] 2.198 ms (148.9%)
iast 2.193 ms [2.13 ms, 2.255 ms] 715.873 µs (48.5%)
iast_GLOBAL 2.245 ms [2.182 ms, 2.308 ms] 768.163 µs (52.0%)
profiling 2.481 ms [2.313 ms, 2.649 ms] 1.005 ms (68.0%)
tracing 2.016 ms [1.968 ms, 2.065 ms] 539.787 µs (36.6%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.474 ms [1.463 ms, 1.486 ms] -
appsec 3.65 ms [3.433 ms, 3.867 ms] 2.176 ms (147.6%)
iast 2.199 ms [2.136 ms, 2.262 ms] 725.224 µs (49.2%)
iast_GLOBAL 2.245 ms [2.182 ms, 2.309 ms] 771.31 µs (52.3%)
profiling 2.068 ms [2.016 ms, 2.12 ms] 594.122 µs (40.3%)
tracing 2.024 ms [1.975 ms, 2.073 ms] 549.707 µs (37.3%)

@bric3 bric3 force-pushed the bdu/add-missing-attributes-in-metrics-key branch from 8c4a17b to 3e3c914 Compare July 16, 2025 09:38
Comment on lines -115 to -117
1 * writer.add(new MetricKey("resource", "service", "operation", "type", HTTP_OK, false), _) >> { MetricKey key, AggregateMetric value ->
value.getHitCount() == 1 && value.getTopLevelCount() == 1 && value.getDuration() == 100
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

1 * writer.add(…, _) >> { MetricKey key, AggregateMetric value -> some assertions }

FYI, these spock code are incorrect, it tries to verify the AggregateMetric, but actually nothing is properly verified, because >> indicates a stub, which is incorrect since it appears in the then section with a verification.

Instead, the verification code should be written this way, with an argument constraint :

1 * writer.add(…, { AggregateMetric value -> some assertions })

for (String peerTag : features.peerTags()) {
Object value = span.getTag(peerTag);
if (value != null) {
peerTags.add(peerTag + ":" + TraceUtils.normalizeTag(value.toString()));
Copy link
Contributor

Choose a reason for hiding this comment

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

I would avoid creating a lot of new strings here. Instead we can return a map view of the tracer tags (a view returning only entries whose key is in peerTags) and write directly key then : then normalize(value) on the messagepack writer. It will avoid create a string here.

Copy link
Contributor

Choose a reason for hiding this comment

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

A simplified version is just to hold key, value here (so that we can use them for the hashtag) but not concat the key:value

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, we're thinking alike!
I had the same thought about String creation. I tried a StringBuilder approach, but without notable benefit in the end on the serialization side, especially since UTF8BytesString actually creates a full String anyway.

The issue with keeping a map view, is it requires to create UTF8BytesString each time this key is serialized. I'll try to come up with a solution that balances both.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes as an idea that can split in a couple of things.
First the need not to concatenate strings. For this you can just store the key in a list of UTF8ByteString (since they peerTags are quite stable they can be converted once anyway) and value in of List<String> and in SerializingMetricWriter just write first the key then : than the normalised value.
I don't think that the values can be efficiently cached since we don't know the cardinality in advance. Converting in UTF8 each time should be fine for now

@bric3 bric3 force-pushed the bdu/add-missing-attributes-in-metrics-key branch from 3e3c914 to 48a0722 Compare July 17, 2025 14:27
StringBuilder peerTagBuilder = new StringBuilder();
for (Map.Entry<String, String> peerTag : peerTags.entrySet()) {
peerTagBuilder.setLength(0);
String toWrite = peerTagBuilder
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering if we can do something to cache them with a DDCache (like 1024 entries assuming that it will be enough for peer tags)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed, that's something on my mind, but there some challenges there that I'd rather work in another smaller PR.

Copy link
Contributor

@amarziali amarziali left a comment

Choose a reason for hiding this comment

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

Looks good. I think we should try adding a cache to the peer tags to avoid creating lots of string

@bric3 bric3 marked this pull request as ready for review July 17, 2025 14:41
@bric3 bric3 requested a review from a team as a code owner July 17, 2025 14:41
@bric3 bric3 requested a review from smola July 17, 2025 14:41
Copy link
Contributor

github-actions bot commented Jul 17, 2025

Hi! 👋 Thanks for your pull request! 🎉

To help us review it, please make sure to:

  • Add at least one type, and one component or instrumentation label to the pull request

If you need help, please check our contributing guidelines.

@bric3 bric3 force-pushed the bdu/add-missing-attributes-in-metrics-key branch from 48a0722 to 2d089ec Compare July 17, 2025 14:51
@bric3 bric3 force-pushed the bdu/add-missing-attributes-in-metrics-key branch from 2d089ec to 696ab1c Compare July 22, 2025 10:41
@bric3 bric3 force-pushed the bdu/add-missing-attributes-in-metrics-key branch 3 times, most recently from b9006af to b7aa90d Compare July 30, 2025 16:26
@bric3 bric3 enabled auto-merge (squash) July 30, 2025 16:29
@bric3
Copy link
Contributor Author

bric3 commented Aug 4, 2025

System tests are failing, need to wait on DataDog/system-tests#5002

@bric3 bric3 added the comp: metrics Metrics label Aug 4, 2025
@bric3 bric3 force-pushed the bdu/add-missing-attributes-in-metrics-key branch from c394992 to b53a739 Compare August 5, 2025 08:45
@datadog-datadog-prod-us1
Copy link
Contributor

datadog-datadog-prod-us1 bot commented Aug 5, 2025

Code coverage: total 59.03%, base diff 1.72%, patch 100.00% (view details)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 318a10e | Docs | Was this helpful? Give us feedback!

@amarziali amarziali force-pushed the bdu/add-missing-attributes-in-metrics-key branch from a5d58e2 to 9154951 Compare August 11, 2025 13:20
@amarziali amarziali added the type: enhancement Enhancements and improvements label Aug 11, 2025
@amarziali amarziali disabled auto-merge August 11, 2025 13:47
bric3 added 2 commits August 12, 2025 08:32
… bucket

# Conflicts:
#	dd-trace-core/src/test/groovy/datadog/trace/common/metrics/FootprintForkedTest.groovy
Also delays the creation of the Utf8ByteString at serialization time.
Note that `writer.writeUTF8` emits a header corresponding to the length
of the value being written, calling this method again will count as an
entry in the array.
A possible idea was to use a cache to store the computation of the
peerTags, however `Utf8ByteString` is not concatenable / appendable,
which is necessary to have the proper encoding. Creating a
new "temporary" `Utf8ByteString`, was replaced by a direct call to
`String: :getBytes`.
* Add jmh for metrics aggregation

* Cache peer tags to avoid too many strings/utf8 conversions

* Use span kind cache

* Fix tests
@amarziali amarziali force-pushed the bdu/add-missing-attributes-in-metrics-key branch from 9154951 to 318a10e Compare August 12, 2025 06:32
Copy link
Contributor

@PerfectSlayer PerfectSlayer left a comment

Choose a reason for hiding this comment

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

Looking good. One comment about code simplification

Comment on lines +65 to +77
private static final DDCache<
String, Pair<DDCache<String, UTF8BytesString>, Function<String, UTF8BytesString>>>
PEER_TAGS_CACHE =
DDCaches.newFixedSizeCache(
64); // it can be unbounded since those values are returned by the agent and should be
// under control. 64 entries is enough in this case to contain all the peer tags.
private static final Function<
String, Pair<DDCache<String, UTF8BytesString>, Function<String, UTF8BytesString>>>
PEER_TAGS_CACHE_ADDER =
key ->
Pair.of(
DDCaches.newFixedSizeCache(512),
value -> UTF8BytesString.create(key + ":" + value));
Copy link
Contributor

Choose a reason for hiding this comment

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

🎯 suggestion: ‏Can't we make a dedicated type for the cache and creator rather than using a Pair<DDCache<String, UTF8BytesString>, Function<String, UTF8BytesString>>? It feels hard to read.

Because it always end up calling cache.computeIfAbsent(key, creator), so the whole Pair<...> thing can be simplified as a functional interface like: Function<String, UTF8BytesString>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp: metrics Metrics type: enhancement Enhancements and improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants