Skip to content

Clean up DSM context injection #8776

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

PerfectSlayer
Copy link
Contributor

@PerfectSlayer PerfectSlayer commented May 7, 2025

What Does This Do

This PR introduce context injection helper methods for HTTP client and server decorators.
Those new methods now handle the Data Streams context injection too, simplifying the instrumentation themselves.
DSM was also refactor to own its data / logic into its own classes rather than relying on the generic tracing ones.
Context API usage was simplified too.

Motivation

This will simplify instrumentation logic by removing most of the DSM code, unless DSM actually has interesting data to send.
This will also reduce context allocation by not updating context if DSM is not enabled.
DSM refactoring should help with code ownership.
Context refactoring should help to set examples about how to use it.

Additional Notes

Injection was moved to the UriBasedClientDecorator rather than the HttpClientDecorator as it is needed for the UrlConnectionDecorator too.
I though about reusing HttpClientDecorator REQUEST type for the injectContext() method and add an abstract setter() method (similar to the HttpServerDecorator.getter() method) but 1. not all setters are stateless (immutable collection make setters need to update their internal references once a field is set) 2. REQUEST and carrier are not always the same type.

Contributor Checklist

Jira ticket: LANGPLAT-474

@pr-commenter
Copy link

pr-commenter bot commented May 7, 2025

Benchmarks

Startup

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master bbujon/context-propagation-dsm
git_commit_date 1746789389 1748266577
git_commit_sha ad6d5fe 9889997
release_version 1.50.0-SNAPSHOT~ad6d5fef42 1.50.0-SNAPSHOT~9889997c55
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1748268988 1748268988
ci_job_id 954178164 954178164
ci_pipeline_id 66114787 66114787
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-8t2n4jps-project-304-concurrent-0-u8uqonua 6.8.0-1029-aws #31~22.04.1-Ubuntu SMP Thu Apr 24 21:16:18 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-8t2n4jps-project-304-concurrent-0-u8uqonua 6.8.0-1029-aws #31~22.04.1-Ubuntu SMP Thu Apr 24 21:16:18 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
module Agent Agent
parent None None
variant iast iast

Summary

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

scenario Δ mean execution_time candidate mean execution_time baseline mean execution_time
scenario:startup:insecure-bank:tracing:Remote Config worse
[+16.717µs; +50.520µs] or [+2.448%; +7.397%]
716.598µs 682.979µs
scenario:startup:petclinic:profiling:ProfilingAgent better
[-9.317ms; -5.434ms] or [-8.413%; -4.907%]
103.370ms 110.745ms
scenario:startup:petclinic:profiling:GlobalTracer better
[-26.888ms; -16.165ms] or [-7.048%; -4.237%]
359.955ms 381.482ms
scenario:startup:petclinic:profiling:AppSec worse
[+4.693ms; +9.277ms] or [+8.553%; +16.910%]
61.849ms 54.864ms
scenario:startup:petclinic:profiling:Profiling better
[-9.318ms; -5.436ms] or [-8.412%; -4.907%]
103.394ms 110.771ms
Startup time reports for petclinic
gantt
    title petclinic - global startup overhead: candidate=1.50.0-SNAPSHOT~9889997c55, baseline=1.50.0-SNAPSHOT~ad6d5fef42

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.019 s) : 0, 1019052
Total [baseline] (10.454 s) : 0, 10453937
Agent [candidate] (1.03 s) : 0, 1030440
Total [candidate] (10.505 s) : 0, 10504825
section appsec
Agent [baseline] (1.172 s) : 0, 1171887
Total [baseline] (10.705 s) : 0, 10704768
Agent [candidate] (1.169 s) : 0, 1169429
Total [candidate] (10.711 s) : 0, 10711069
section iast
Agent [baseline] (1.163 s) : 0, 1163003
Total [baseline] (10.919 s) : 0, 10918904
Agent [candidate] (1.163 s) : 0, 1162833
Total [candidate] (10.872 s) : 0, 10872175
section profiling
Agent [baseline] (1.296 s) : 0, 1296421
Total [baseline] (10.972 s) : 0, 10971661
Agent [candidate] (1.265 s) : 0, 1264590
Total [candidate] (10.822 s) : 0, 10822498
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.019 s -
Agent appsec 1.172 s 152.835 ms (15.0%)
Agent iast 1.163 s 143.951 ms (14.1%)
Agent profiling 1.296 s 277.369 ms (27.2%)
Total tracing 10.454 s -
Total appsec 10.705 s 250.832 ms (2.4%)
Total iast 10.919 s 464.967 ms (4.4%)
Total profiling 10.972 s 517.724 ms (5.0%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.03 s -
Agent appsec 1.169 s 138.99 ms (13.5%)
Agent iast 1.163 s 132.394 ms (12.8%)
Agent profiling 1.265 s 234.151 ms (22.7%)
Total tracing 10.505 s -
Total appsec 10.711 s 206.243 ms (2.0%)
Total iast 10.872 s 367.35 ms (3.5%)
Total profiling 10.822 s 317.672 ms (3.0%)
gantt
    title petclinic - break down per module: candidate=1.50.0-SNAPSHOT~9889997c55, baseline=1.50.0-SNAPSHOT~ad6d5fef42

    dateFormat X
    axisFormat %s
section tracing
BytebuddyAgent [baseline] (682.02 ms) : 0, 682020
BytebuddyAgent [candidate] (689.372 ms) : 0, 689372
GlobalTracer [baseline] (240.594 ms) : 0, 240594
GlobalTracer [candidate] (242.934 ms) : 0, 242934
AppSec [baseline] (55.194 ms) : 0, 55194
AppSec [candidate] (55.568 ms) : 0, 55568
Debugger [baseline] (6.908 ms) : 0, 6908
Debugger [candidate] (9.783 ms) : 0, 9783
Remote Config [baseline] (706.45 µs) : 0, 706
Remote Config [candidate] (700.226 µs) : 0, 700
Telemetry [baseline] (10.126 ms) : 0, 10126
Telemetry [candidate] (8.278 ms) : 0, 8278
section appsec
BytebuddyAgent [baseline] (707.632 ms) : 0, 707632
BytebuddyAgent [candidate] (706.369 ms) : 0, 706369
GlobalTracer [baseline] (238.507 ms) : 0, 238507
GlobalTracer [candidate] (238.296 ms) : 0, 238296
AppSec [baseline] (176.499 ms) : 0, 176499
AppSec [candidate] (176.155 ms) : 0, 176155
Debugger [baseline] (5.972 ms) : 0, 5972
Debugger [candidate] (5.976 ms) : 0, 5976
Remote Config [baseline] (622.575 µs) : 0, 623
Remote Config [candidate] (640.838 µs) : 0, 641
Telemetry [baseline] (7.761 ms) : 0, 7761
Telemetry [candidate] (7.434 ms) : 0, 7434
IAST [baseline] (22.271 ms) : 0, 22271
IAST [candidate] (21.714 ms) : 0, 21714
section iast
BytebuddyAgent [baseline] (812.51 ms) : 0, 812510
BytebuddyAgent [candidate] (812.65 ms) : 0, 812650
GlobalTracer [baseline] (232.623 ms) : 0, 232623
GlobalTracer [candidate] (233.123 ms) : 0, 233123
AppSec [baseline] (51.654 ms) : 0, 51654
AppSec [candidate] (48.625 ms) : 0, 48625
Debugger [baseline] (6.013 ms) : 0, 6013
Debugger [candidate] (5.957 ms) : 0, 5957
Remote Config [baseline] (606.892 µs) : 0, 607
Remote Config [candidate] (591.507 µs) : 0, 592
Telemetry [baseline] (8.001 ms) : 0, 8001
Telemetry [candidate] (7.88 ms) : 0, 7880
IAST [baseline] (27.044 ms) : 0, 27044
IAST [candidate] (30.194 ms) : 0, 30194
section profiling
BytebuddyAgent [baseline] (682.99 ms) : 0, 682990
BytebuddyAgent [candidate] (673.457 ms) : 0, 673457
GlobalTracer [baseline] (381.482 ms) : 0, 381482
GlobalTracer [candidate] (359.955 ms) : 0, 359955
AppSec [baseline] (54.864 ms) : 0, 54864
AppSec [candidate] (61.849 ms) : 0, 61849
Debugger [baseline] (6.21 ms) : 0, 6210
Debugger [candidate] (6.255 ms) : 0, 6255
Remote Config [baseline] (653.466 µs) : 0, 653
Remote Config [candidate] (647.55 µs) : 0, 648
Telemetry [baseline] (8.246 ms) : 0, 8246
Telemetry [candidate] (8.192 ms) : 0, 8192
ProfilingAgent [baseline] (110.745 ms) : 0, 110745
ProfilingAgent [candidate] (103.37 ms) : 0, 103370
Profiling [baseline] (110.771 ms) : 0, 110771
Profiling [candidate] (103.394 ms) : 0, 103394
Loading
Startup time reports for insecure-bank
gantt
    title insecure-bank - global startup overhead: candidate=1.50.0-SNAPSHOT~9889997c55, baseline=1.50.0-SNAPSHOT~ad6d5fef42

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.019 s) : 0, 1019004
Total [baseline] (8.646 s) : 0, 8646354
Agent [candidate] (1.025 s) : 0, 1024733
Total [candidate] (8.644 s) : 0, 8643786
section iast
Agent [baseline] (1.148 s) : 0, 1147832
Total [baseline] (9.21 s) : 0, 9209738
Agent [candidate] (1.157 s) : 0, 1156633
Total [candidate] (9.237 s) : 0, 9237157
section iast_HARDCODED_SECRET_DISABLED
Agent [baseline] (1.147 s) : 0, 1147020
Total [baseline] (9.207 s) : 0, 9206817
Agent [candidate] (1.166 s) : 0, 1165904
Total [candidate] (9.193 s) : 0, 9193447
section iast_TELEMETRY_OFF
Agent [baseline] (1.152 s) : 0, 1151671
Total [baseline] (9.238 s) : 0, 9238374
Agent [candidate] (1.147 s) : 0, 1146704
Total [candidate] (9.254 s) : 0, 9254048
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.019 s -
Agent iast 1.148 s 128.828 ms (12.6%)
Agent iast_HARDCODED_SECRET_DISABLED 1.147 s 128.016 ms (12.6%)
Agent iast_TELEMETRY_OFF 1.152 s 132.667 ms (13.0%)
Total tracing 8.646 s -
Total iast 9.21 s 563.384 ms (6.5%)
Total iast_HARDCODED_SECRET_DISABLED 9.207 s 560.463 ms (6.5%)
Total iast_TELEMETRY_OFF 9.238 s 592.02 ms (6.8%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.025 s -
Agent iast 1.157 s 131.899 ms (12.9%)
Agent iast_HARDCODED_SECRET_DISABLED 1.166 s 141.17 ms (13.8%)
Agent iast_TELEMETRY_OFF 1.147 s 121.97 ms (11.9%)
Total tracing 8.644 s -
Total iast 9.237 s 593.371 ms (6.9%)
Total iast_HARDCODED_SECRET_DISABLED 9.193 s 549.662 ms (6.4%)
Total iast_TELEMETRY_OFF 9.254 s 610.262 ms (7.1%)
gantt
    title insecure-bank - break down per module: candidate=1.50.0-SNAPSHOT~9889997c55, baseline=1.50.0-SNAPSHOT~ad6d5fef42

    dateFormat X
    axisFormat %s
section tracing
BytebuddyAgent [baseline] (680.013 ms) : 0, 680013
BytebuddyAgent [candidate] (687.094 ms) : 0, 687094
GlobalTracer [baseline] (238.941 ms) : 0, 238941
GlobalTracer [candidate] (241.191 ms) : 0, 241191
AppSec [baseline] (54.999 ms) : 0, 54999
AppSec [candidate] (54.598 ms) : 0, 54598
Debugger [baseline] (10.43 ms) : 0, 10430
Debugger [candidate] (7.675 ms) : 0, 7675
Remote Config [baseline] (682.979 µs) : 0, 683
Remote Config [candidate] (716.598 µs) : 0, 717
Telemetry [baseline] (10.427 ms) : 0, 10427
Telemetry [candidate] (9.138 ms) : 0, 9138
section iast
BytebuddyAgent [baseline] (801.874 ms) : 0, 801874
BytebuddyAgent [candidate] (806.47 ms) : 0, 806470
GlobalTracer [baseline] (229.959 ms) : 0, 229959
GlobalTracer [candidate] (233.142 ms) : 0, 233142
AppSec [baseline] (48.36 ms) : 0, 48360
AppSec [candidate] (50.552 ms) : 0, 50552
Debugger [baseline] (5.889 ms) : 0, 5889
Debugger [candidate] (5.945 ms) : 0, 5945
Remote Config [baseline] (593.01 µs) : 0, 593
Remote Config [candidate] (591.776 µs) : 0, 592
Telemetry [baseline] (7.866 ms) : 0, 7866
Telemetry [candidate] (7.917 ms) : 0, 7917
IAST [baseline] (29.831 ms) : 0, 29831
IAST [candidate] (28.539 ms) : 0, 28539
section iast_HARDCODED_SECRET_DISABLED
BytebuddyAgent [baseline] (800.513 ms) : 0, 800513
BytebuddyAgent [candidate] (814.272 ms) : 0, 814272
GlobalTracer [baseline] (230.45 ms) : 0, 230450
GlobalTracer [candidate] (233.605 ms) : 0, 233605
AppSec [baseline] (49.993 ms) : 0, 49993
AppSec [candidate] (50.862 ms) : 0, 50862
Debugger [baseline] (5.856 ms) : 0, 5856
Debugger [candidate] (5.998 ms) : 0, 5998
Remote Config [baseline] (580.239 µs) : 0, 580
Remote Config [candidate] (610.041 µs) : 0, 610
Telemetry [baseline] (7.86 ms) : 0, 7860
Telemetry [candidate] (8.001 ms) : 0, 8001
IAST [baseline] (28.27 ms) : 0, 28270
IAST [candidate] (28.755 ms) : 0, 28755
section iast_TELEMETRY_OFF
BytebuddyAgent [baseline] (803.674 ms) : 0, 803674
BytebuddyAgent [candidate] (799.079 ms) : 0, 799079
GlobalTracer [baseline] (231.018 ms) : 0, 231018
GlobalTracer [candidate] (231.233 ms) : 0, 231233
AppSec [baseline] (55.578 ms) : 0, 55578
AppSec [candidate] (56.073 ms) : 0, 56073
Debugger [baseline] (5.997 ms) : 0, 5997
Debugger [candidate] (5.971 ms) : 0, 5971
Remote Config [baseline] (611.293 µs) : 0, 611
Remote Config [candidate] (610.606 µs) : 0, 611
Telemetry [baseline] (7.902 ms) : 0, 7902
Telemetry [candidate] (7.87 ms) : 0, 7870
IAST [baseline] (23.201 ms) : 0, 23201
IAST [candidate] (22.294 ms) : 0, 22294
Loading

Load

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
end_time 2025-05-26T13:49:39 2025-05-26T13:57:22
git_branch master bbujon/context-propagation-dsm
git_commit_date 1746789389 1748266577
git_commit_sha ad6d5fe 9889997
release_version 1.50.0-SNAPSHOT~ad6d5fef42 1.50.0-SNAPSHOT~9889997c55
start_time 2025-05-26T13:49:25 2025-05-26T13:57:08
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1748268239 1748268239
ci_job_id 954178165 954178165
ci_pipeline_id 66114787 66114787
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-a5ynt5bs-project-304-concurrent-0-yqlu4jq2 6.8.0-1029-aws #31~22.04.1-Ubuntu SMP Thu Apr 24 21:16:18 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-a5ynt5bs-project-304-concurrent-0-yqlu4jq2 6.8.0-1029-aws #31~22.04.1-Ubuntu SMP Thu Apr 24 21:16:18 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
variant iast iast

Summary

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

Request duration reports for petclinic
gantt
    title petclinic - request duration [CI 0.99] : candidate=1.50.0-SNAPSHOT~9889997c55, baseline=1.50.0-SNAPSHOT~ad6d5fef42
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.345 ms) : 1325, 1364
.   : milestone, 1345,
appsec (1.733 ms) : 1710, 1756
.   : milestone, 1733,
appsec_no_iast (1.728 ms) : 1704, 1751
.   : milestone, 1728,
code_origins (1.657 ms) : 1630, 1685
.   : milestone, 1657,
iast (1.524 ms) : 1500, 1549
.   : milestone, 1524,
profiling (1.512 ms) : 1488, 1536
.   : milestone, 1512,
tracing (1.486 ms) : 1462, 1511
.   : milestone, 1486,
section candidate
no_agent (1.356 ms) : 1336, 1377
.   : milestone, 1356,
appsec (1.722 ms) : 1699, 1746
.   : milestone, 1722,
appsec_no_iast (1.736 ms) : 1713, 1760
.   : milestone, 1736,
code_origins (1.693 ms) : 1666, 1721
.   : milestone, 1693,
iast (1.521 ms) : 1497, 1546
.   : milestone, 1521,
profiling (1.508 ms) : 1485, 1531
.   : milestone, 1508,
tracing (1.508 ms) : 1483, 1533
.   : milestone, 1508,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 1.345 ms [1.325 ms, 1.364 ms] -
appsec 1.733 ms [1.71 ms, 1.756 ms] 388.213 µs (28.9%)
appsec_no_iast 1.728 ms [1.704 ms, 1.751 ms] 382.66 µs (28.5%)
code_origins 1.657 ms [1.63 ms, 1.685 ms] 312.367 µs (23.2%)
iast 1.524 ms [1.5 ms, 1.549 ms] 179.437 µs (13.3%)
profiling 1.512 ms [1.488 ms, 1.536 ms] 167.196 µs (12.4%)
tracing 1.486 ms [1.462 ms, 1.511 ms] 141.448 µs (10.5%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 1.356 ms [1.336 ms, 1.377 ms] -
appsec 1.722 ms [1.699 ms, 1.746 ms] 365.878 µs (27.0%)
appsec_no_iast 1.736 ms [1.713 ms, 1.76 ms] 379.723 µs (28.0%)
code_origins 1.693 ms [1.666 ms, 1.721 ms] 336.977 µs (24.8%)
iast 1.521 ms [1.497 ms, 1.546 ms] 164.741 µs (12.1%)
profiling 1.508 ms [1.485 ms, 1.531 ms] 151.289 µs (11.2%)
tracing 1.508 ms [1.483 ms, 1.533 ms] 151.5 µs (11.2%)
Request duration reports for insecure-bank
gantt
    title insecure-bank - request duration [CI 0.99] : candidate=1.50.0-SNAPSHOT~9889997c55, baseline=1.50.0-SNAPSHOT~ad6d5fef42
    dateFormat X
    axisFormat %s
section baseline
no_agent (377.983 µs) : 358, 398
.   : milestone, 378,
iast (513.925 µs) : 492, 536
.   : milestone, 514,
iast_FULL (730.111 µs) : 708, 752
.   : milestone, 730,
iast_GLOBAL (557.922 µs) : 535, 581
.   : milestone, 558,
iast_HARDCODED_SECRET_DISABLED (517.273 µs) : 495, 540
.   : milestone, 517,
iast_INACTIVE (467.105 µs) : 444, 490
.   : milestone, 467,
iast_TELEMETRY_OFF (517.4 µs) : 494, 541
.   : milestone, 517,
tracing (459.916 µs) : 438, 482
.   : milestone, 460,
section candidate
no_agent (385.249 µs) : 366, 405
.   : milestone, 385,
iast (519.792 µs) : 497, 543
.   : milestone, 520,
iast_FULL (730.957 µs) : 709, 753
.   : milestone, 731,
iast_GLOBAL (560.426 µs) : 539, 582
.   : milestone, 560,
iast_HARDCODED_SECRET_DISABLED (529.605 µs) : 507, 553
.   : milestone, 530,
iast_INACTIVE (471.505 µs) : 449, 494
.   : milestone, 472,
iast_TELEMETRY_OFF (504.381 µs) : 480, 528
.   : milestone, 504,
tracing (454.337 µs) : 432, 477
.   : milestone, 454,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 377.983 µs [358.401 µs, 397.565 µs] -
iast 513.925 µs [492.128 µs, 535.723 µs] 135.942 µs (36.0%)
iast_FULL 730.111 µs [708.192 µs, 752.03 µs] 352.128 µs (93.2%)
iast_GLOBAL 557.922 µs [535.22 µs, 580.625 µs] 179.939 µs (47.6%)
iast_HARDCODED_SECRET_DISABLED 517.273 µs [494.723 µs, 539.823 µs] 139.29 µs (36.9%)
iast_INACTIVE 467.105 µs [444.374 µs, 489.836 µs] 89.122 µs (23.6%)
iast_TELEMETRY_OFF 517.4 µs [494.118 µs, 540.683 µs] 139.417 µs (36.9%)
tracing 459.916 µs [437.718 µs, 482.115 µs] 81.933 µs (21.7%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 385.249 µs [365.572 µs, 404.927 µs] -
iast 519.792 µs [496.508 µs, 543.077 µs] 134.543 µs (34.9%)
iast_FULL 730.957 µs [709.099 µs, 752.816 µs] 345.708 µs (89.7%)
iast_GLOBAL 560.426 µs [538.594 µs, 582.258 µs] 175.176 µs (45.5%)
iast_HARDCODED_SECRET_DISABLED 529.605 µs [506.532 µs, 552.678 µs] 144.356 µs (37.5%)
iast_INACTIVE 471.505 µs [448.849 µs, 494.161 µs] 86.255 µs (22.4%)
iast_TELEMETRY_OFF 504.381 µs [480.264 µs, 528.498 µs] 119.132 µs (30.9%)
tracing 454.337 µs [432.044 µs, 476.631 µs] 69.088 µs (17.9%)

Dacapo

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master bbujon/context-propagation-dsm
git_commit_date 1746789389 1748266577
git_commit_sha ad6d5fe 9889997
release_version 1.50.0-SNAPSHOT~ad6d5fef42 1.50.0-SNAPSHOT~9889997c55
See matching parameters
Baseline Candidate
application biojava biojava
ci_job_date 1748268681 1748268681
ci_job_id 954178166 954178166
ci_pipeline_id 66114787 66114787
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-zghvxubd-project-304-concurrent-0-6ko0z940 6.8.0-1029-aws #31~22.04.1-Ubuntu SMP Thu Apr 24 21:16:18 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-zghvxubd-project-304-concurrent-0-6ko0z940 6.8.0-1029-aws #31~22.04.1-Ubuntu SMP Thu Apr 24 21:16:18 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
variant appsec appsec

Summary

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

Execution time for tomcat
gantt
    title tomcat - execution time [CI 0.99] : candidate=1.50.0-SNAPSHOT~9889997c55, baseline=1.50.0-SNAPSHOT~ad6d5fef42
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.472 ms) : 1460, 1483
.   : milestone, 1472,
appsec (2.403 ms) : 2354, 2452
.   : milestone, 2403,
iast (2.175 ms) : 2114, 2236
.   : milestone, 2175,
iast_GLOBAL (2.221 ms) : 2159, 2283
.   : milestone, 2221,
profiling (2.032 ms) : 1982, 2082
.   : milestone, 2032,
tracing (2.011 ms) : 1964, 2059
.   : milestone, 2011,
section candidate
no_agent (1.477 ms) : 1465, 1488
.   : milestone, 1477,
appsec (2.397 ms) : 2348, 2445
.   : milestone, 2397,
iast (2.175 ms) : 2114, 2236
.   : milestone, 2175,
iast_GLOBAL (2.215 ms) : 2154, 2277
.   : milestone, 2215,
profiling (2.029 ms) : 1980, 2079
.   : milestone, 2029,
tracing (1.991 ms) : 1944, 2038
.   : milestone, 1991,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.472 ms [1.46 ms, 1.483 ms] -
appsec 2.403 ms [2.354 ms, 2.452 ms] 931.114 µs (63.3%)
iast 2.175 ms [2.114 ms, 2.236 ms] 703.469 µs (47.8%)
iast_GLOBAL 2.221 ms [2.159 ms, 2.283 ms] 749.04 µs (50.9%)
profiling 2.032 ms [1.982 ms, 2.082 ms] 559.854 µs (38.0%)
tracing 2.011 ms [1.964 ms, 2.059 ms] 539.538 µs (36.7%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.477 ms [1.465 ms, 1.488 ms] -
appsec 2.397 ms [2.348 ms, 2.445 ms] 919.702 µs (62.3%)
iast 2.175 ms [2.114 ms, 2.236 ms] 697.885 µs (47.3%)
iast_GLOBAL 2.215 ms [2.154 ms, 2.277 ms] 738.499 µs (50.0%)
profiling 2.029 ms [1.98 ms, 2.079 ms] 552.204 µs (37.4%)
tracing 1.991 ms [1.944 ms, 2.038 ms] 514.371 µs (34.8%)
Execution time for biojava
gantt
    title biojava - execution time [CI 0.99] : candidate=1.50.0-SNAPSHOT~9889997c55, baseline=1.50.0-SNAPSHOT~ad6d5fef42
    dateFormat X
    axisFormat %s
section baseline
no_agent (15.65 s) : 15650000, 15650000
.   : milestone, 15650000,
appsec (14.868 s) : 14868000, 14868000
.   : milestone, 14868000,
iast (18.231 s) : 18231000, 18231000
.   : milestone, 18231000,
iast_GLOBAL (17.972 s) : 17972000, 17972000
.   : milestone, 17972000,
profiling (15.748 s) : 15748000, 15748000
.   : milestone, 15748000,
tracing (15.047 s) : 15047000, 15047000
.   : milestone, 15047000,
section candidate
no_agent (15.178 s) : 15178000, 15178000
.   : milestone, 15178000,
appsec (14.961 s) : 14961000, 14961000
.   : milestone, 14961000,
iast (18.755 s) : 18755000, 18755000
.   : milestone, 18755000,
iast_GLOBAL (18.12 s) : 18120000, 18120000
.   : milestone, 18120000,
profiling (15.03 s) : 15030000, 15030000
.   : milestone, 15030000,
tracing (14.916 s) : 14916000, 14916000
.   : milestone, 14916000,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 15.65 s [15.65 s, 15.65 s] -
appsec 14.868 s [14.868 s, 14.868 s] -782.0 ms (-5.0%)
iast 18.231 s [18.231 s, 18.231 s] 2.581 s (16.5%)
iast_GLOBAL 17.972 s [17.972 s, 17.972 s] 2.322 s (14.8%)
profiling 15.748 s [15.748 s, 15.748 s] 98.0 ms (0.6%)
tracing 15.047 s [15.047 s, 15.047 s] -603.0 ms (-3.9%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 15.178 s [15.178 s, 15.178 s] -
appsec 14.961 s [14.961 s, 14.961 s] -217.0 ms (-1.4%)
iast 18.755 s [18.755 s, 18.755 s] 3.577 s (23.6%)
iast_GLOBAL 18.12 s [18.12 s, 18.12 s] 2.942 s (19.4%)
profiling 15.03 s [15.03 s, 15.03 s] -148.0 ms (-1.0%)
tracing 14.916 s [14.916 s, 14.916 s] -262.0 ms (-1.7%)

@PerfectSlayer PerfectSlayer force-pushed the bbujon/context-propagation-dsm branch from 5f1247d to 3b7384c Compare May 26, 2025 08:43
@@ -8,16 +8,47 @@
public class DataStreamsContext implements ImplicitContextKeyed {
private static final ContextKey<DataStreamsContext> CONTEXT_KEY =
ContextKey.named("dsm-context-key");
private static final LinkedHashMap<String, String> CLIENT_PATHWAY_EDGE_TAGS;
private static final LinkedHashMap<String, String> SERVER_PATHWAY_EDGE_TAGS;
Copy link
Contributor

Choose a reason for hiding this comment

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

Code Quality Violation

Suggested change
private static final LinkedHashMap<String, String> SERVER_PATHWAY_EDGE_TAGS;
private static final Map<String, String> SERVER_PATHWAY_EDGE_TAGS;
Avoid using a specific implementation type; use the more general Map instead (...read more)

Relying on particular implementation types, such as, HashSet or LinkedList can limit your adaptability to embrace alternative implementations in the future, particularly as your requirements change and your code needs to undergo changes.

It is recommended to opt for general types such as Set or List when declaring variables and parameters.

View in Datadog  Leave us feedback  Documentation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah... We asked the DSM team to create their own data structure but not much update about it 🤷

@@ -8,16 +8,47 @@
public class DataStreamsContext implements ImplicitContextKeyed {
private static final ContextKey<DataStreamsContext> CONTEXT_KEY =
ContextKey.named("dsm-context-key");
private static final LinkedHashMap<String, String> CLIENT_PATHWAY_EDGE_TAGS;
Copy link
Contributor

Choose a reason for hiding this comment

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

Code Quality Violation

Suggested change
private static final LinkedHashMap<String, String> CLIENT_PATHWAY_EDGE_TAGS;
private static final Map<String, String> CLIENT_PATHWAY_EDGE_TAGS;
Avoid using a specific implementation type; use the more general Map instead (...read more)

Relying on particular implementation types, such as, HashSet or LinkedList can limit your adaptability to embrace alternative implementations in the future, particularly as your requirements change and your code needs to undergo changes.

It is recommended to opt for general types such as Set or List when declaring variables and parameters.

View in Datadog  Leave us feedback  Documentation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah... We asked the DSM team to create their own data structure but not much update about it 🤷

@PerfectSlayer PerfectSlayer force-pushed the bbujon/context-propagation-dsm branch 2 times, most recently from 08c2357 to 08df84e Compare May 26, 2025 11:49
@PerfectSlayer PerfectSlayer force-pushed the bbujon/context-propagation-dsm branch from 08df84e to 9889997 Compare May 26, 2025 13:37
@PerfectSlayer PerfectSlayer marked this pull request as ready for review May 26, 2025 15:56
@PerfectSlayer PerfectSlayer requested review from a team as code owners May 26, 2025 15:56
@PerfectSlayer PerfectSlayer requested a review from smola May 26, 2025 15:56
Copy link
Contributor

@mhlidd mhlidd left a comment

Choose a reason for hiding this comment

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

Looks much cleaner now! Just a few small comments/questions, but otherwise the DSM context specific changes look good. I'll defer the other changes (StatsBucket) to another reviewer.

final TraceConfig tracerConfig;
return (agentSpan = AgentSpan.fromContext(context)) != null
&& (tracerConfig = agentSpan.traceConfig()) != null
&& tracerConfig.isDataStreamsEnabled();
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to fetch the isDataStreamsEnabled() through tracerConfig? How is this different from getting it directly from Config.get()?

Also this seems to be also added in DataStreamsMonitoring.java. Do we need it in both places or can we remove it here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why do we need to fetch the isDataStreamsEnabled() through tracerConfig? How is this different from getting it directly from Config.get()?

Not sure but I think it might be related to remove config. I would need more details from the DSM team itself. I will ping it from its channel.

Do we need it in both places or can we remove it here?

There is one in decorator to avoid DSM context allocation and new context creation (the context.with() call).
While the one in the propagator is here to make sure we don't propagate if the feature is not enabled.
While the later is product related, the former is for performance concern.
If we can simplify the check, I would not mind having him twice. Let's see what the DSM team think about it first.

public static final GrpcClientDecorator DECORATE = new GrpcClientDecorator();

private static final Set<String> IGNORED_METHODS = Config.get().getGrpcIgnoredOutboundMethods();
private static final BitSet CLIENT_ERROR_STATUSES = Config.get().getGrpcClientErrorStatuses();
private static final boolean DATA_STREAMS_ENABLED = Config.get().isDataStreamsEnabled();
Copy link
Contributor

Choose a reason for hiding this comment

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

Same as above, what's the difference between getting the config value from Config.get() vs AgentSpan.tracerConfig()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I introduced this guard as performance improvement. Let have the DSM team answer about the config / activation thing.

@@ -11,6 +17,7 @@ public class RequestDispatcherDecorator extends BaseDecorator {
UTF8BytesString.create("java-web-servlet-dispatcher");
public static final String DD_CONTEXT_PATH_ATTRIBUTE = "datadog.context.path";
public static final String DD_SERVLET_PATH_ATTRIBUTE = "datadog.servlet.path";
private static final boolean DATA_STREAMS_ENABLED = Config.get().isDataStreamsEnabled();
Copy link
Contributor

Choose a reason for hiding this comment

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

Same question as above.

Comment on lines +54 to +56
|| (dsmContext = DataStreamsContext.fromContext(context)) == null
|| (traceConfig = span.traceConfig()) == null
|| !traceConfig.isDataStreamsEnabled()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I see this check is the same as the one in UriBasedClientDecorator.java. Is there a need to have it in both places? I would understand that having this check in UriBasedClientDecorator and the 2 GrpcClientDecorator could be repetitive, so could we remove all checks to traceConfig except this one?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants