Skip to content

Conversation

PerfectSlayer
Copy link
Contributor

@PerfectSlayer PerfectSlayer commented Aug 19, 2025

What Does This Do

This PR continues @zarirhamza work about Serverless gateway inferred span in #8336 and brings the following improvements:

  • Avoid duplicate expensive context extraction
  • Avoid subclassing tracing span for serverless but used serverless context element instead to store / track inferred span while keep tracing feature untouched
  • Improved propagator to not create / capture inferred span context element on invalid data
  • Rework context element to hold the inferred spans and its captured data
  • Release captured data as soon as they span start (never read after this point so reclaiming memory)
  • Refactor context element and propagator into the right package, not context component (product / feature agnostic)
  • Refactor unit tests

Motivation

Restore Serverless feature while meeting design and performance requirements

Additional Notes

This requires to complete the instrumentation refactoring first.
I already did a lot of them here:

The last one is pending for review:

Contributor Checklist

Jira ticket: LANGPLAT-680

@PerfectSlayer PerfectSlayer added tag: do not merge Do not merge changes inst: others All other instrumentations type: refactoring tag: serverless Serverless support labels Aug 19, 2025
@datadog-datadog-prod-us1
Copy link
Contributor

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

🎯 Code Coverage
Patch Coverage: 77.63%
Total Coverage: 59.66% (-0.01%)

View detailed report

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

@pr-commenter
Copy link

pr-commenter bot commented Aug 19, 2025

Benchmarks

Startup

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master bbujon/gateway-inferred-span2
git_commit_date 1758039856 1758040797
git_commit_sha 44e5822 eb6874e
release_version 1.54.0-SNAPSHOT~44e5822d88 1.54.0-SNAPSHOT~eb6874e7eb
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1758042680 1758042680
ci_job_id 1132053609 1132053609
ci_pipeline_id 76644764 76644764
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-fm33ofvh 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-fm33ofvh 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 52 metrics, 7 unstable metrics.

Startup time reports for petclinic
gantt
    title petclinic - global startup overhead: candidate=1.54.0-SNAPSHOT~eb6874e7eb, baseline=1.54.0-SNAPSHOT~44e5822d88

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.062 s) : 0, 1061674
Total [baseline] (10.691 s) : 0, 10691132
Agent [candidate] (1.075 s) : 0, 1075168
Total [candidate] (10.71 s) : 0, 10709901
section appsec
Agent [baseline] (1.236 s) : 0, 1235980
Total [baseline] (10.997 s) : 0, 10997345
Agent [candidate] (1.243 s) : 0, 1243480
Total [candidate] (11.022 s) : 0, 11021617
section iast
Agent [baseline] (1.191 s) : 0, 1191345
Total [baseline] (11.054 s) : 0, 11053753
Agent [candidate] (1.202 s) : 0, 1202416
Total [candidate] (11.008 s) : 0, 11008252
section profiling
Agent [baseline] (1.209 s) : 0, 1209134
Total [baseline] (10.85 s) : 0, 10850495
Agent [candidate] (1.207 s) : 0, 1206648
Total [candidate] (10.837 s) : 0, 10837392
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.062 s -
Agent appsec 1.236 s 174.306 ms (16.4%)
Agent iast 1.191 s 129.671 ms (12.2%)
Agent profiling 1.209 s 147.46 ms (13.9%)
Total tracing 10.691 s -
Total appsec 10.997 s 306.213 ms (2.9%)
Total iast 11.054 s 362.622 ms (3.4%)
Total profiling 10.85 s 159.363 ms (1.5%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.075 s -
Agent appsec 1.243 s 168.313 ms (15.7%)
Agent iast 1.202 s 127.249 ms (11.8%)
Agent profiling 1.207 s 131.48 ms (12.2%)
Total tracing 10.71 s -
Total appsec 11.022 s 311.716 ms (2.9%)
Total iast 11.008 s 298.351 ms (2.8%)
Total profiling 10.837 s 127.491 ms (1.2%)
gantt
    title petclinic - break down per module: candidate=1.54.0-SNAPSHOT~eb6874e7eb, baseline=1.54.0-SNAPSHOT~44e5822d88

    dateFormat X
    axisFormat %s
section tracing
crashtracking [baseline] (1.452 ms) : 0, 1452
crashtracking [candidate] (1.463 ms) : 0, 1463
BytebuddyAgent [baseline] (732.299 ms) : 0, 732299
BytebuddyAgent [candidate] (740.731 ms) : 0, 740731
GlobalTracer [baseline] (252.881 ms) : 0, 252881
GlobalTracer [candidate] (256.812 ms) : 0, 256812
AppSec [baseline] (30.572 ms) : 0, 30572
AppSec [candidate] (31.282 ms) : 0, 31282
Debugger [baseline] (6.391 ms) : 0, 6391
Debugger [candidate] (6.51 ms) : 0, 6510
Remote Config [baseline] (692.229 µs) : 0, 692
Remote Config [candidate] (705.945 µs) : 0, 706
Telemetry [baseline] (16.343 ms) : 0, 16343
Telemetry [candidate] (16.39 ms) : 0, 16390
section appsec
crashtracking [baseline] (1.46 ms) : 0, 1460
crashtracking [candidate] (1.477 ms) : 0, 1477
BytebuddyAgent [baseline] (756.122 ms) : 0, 756122
BytebuddyAgent [candidate] (761.055 ms) : 0, 761055
GlobalTracer [baseline] (246.406 ms) : 0, 246406
GlobalTracer [candidate] (247.188 ms) : 0, 247188
IAST [baseline] (23.812 ms) : 0, 23812
IAST [candidate] (23.992 ms) : 0, 23992
AppSec [baseline] (171.71 ms) : 0, 171710
AppSec [candidate] (173.021 ms) : 0, 173021
Debugger [baseline] (6.054 ms) : 0, 6054
Debugger [candidate] (6.132 ms) : 0, 6132
Remote Config [baseline] (626.48 µs) : 0, 626
Remote Config [candidate] (649.601 µs) : 0, 650
Telemetry [baseline] (8.558 ms) : 0, 8558
Telemetry [candidate] (8.675 ms) : 0, 8675
section iast
crashtracking [baseline] (1.463 ms) : 0, 1463
crashtracking [candidate] (1.47 ms) : 0, 1470
BytebuddyAgent [baseline] (852.472 ms) : 0, 852472
BytebuddyAgent [candidate] (861.528 ms) : 0, 861528
GlobalTracer [baseline] (245.636 ms) : 0, 245636
GlobalTracer [candidate] (248.185 ms) : 0, 248185
IAST [baseline] (29.46 ms) : 0, 29460
IAST [candidate] (28.888 ms) : 0, 28888
AppSec [baseline] (26.589 ms) : 0, 26589
AppSec [candidate] (26.379 ms) : 0, 26379
Debugger [baseline] (6.093 ms) : 0, 6093
Debugger [candidate] (6.06 ms) : 0, 6060
Remote Config [baseline] (593.125 µs) : 0, 593
Remote Config [candidate] (611.488 µs) : 0, 611
Telemetry [baseline] (8.068 ms) : 0, 8068
Telemetry [candidate] (8.147 ms) : 0, 8147
section profiling
crashtracking [baseline] (1.436 ms) : 0, 1436
crashtracking [candidate] (1.432 ms) : 0, 1432
BytebuddyAgent [baseline] (761.994 ms) : 0, 761994
BytebuddyAgent [candidate] (760.106 ms) : 0, 760106
GlobalTracer [baseline] (232.824 ms) : 0, 232824
GlobalTracer [candidate] (232.195 ms) : 0, 232195
AppSec [baseline] (30.449 ms) : 0, 30449
AppSec [candidate] (30.244 ms) : 0, 30244
Debugger [baseline] (13.738 ms) : 0, 13738
Debugger [candidate] (12.067 ms) : 0, 12067
Remote Config [baseline] (748.048 µs) : 0, 748
Remote Config [candidate] (2.323 ms) : 0, 2323
Telemetry [baseline] (9.252 ms) : 0, 9252
Telemetry [candidate] (9.502 ms) : 0, 9502
ProfilingAgent [baseline] (107.518 ms) : 0, 107518
ProfilingAgent [candidate] (107.608 ms) : 0, 107608
Profiling [baseline] (108.162 ms) : 0, 108162
Profiling [candidate] (108.263 ms) : 0, 108263
Loading
Startup time reports for insecure-bank
gantt
    title insecure-bank - global startup overhead: candidate=1.54.0-SNAPSHOT~eb6874e7eb, baseline=1.54.0-SNAPSHOT~44e5822d88

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.063 s) : 0, 1063105
Total [baseline] (8.616 s) : 0, 8616108
Agent [candidate] (1.07 s) : 0, 1070325
Total [candidate] (8.633 s) : 0, 8633354
section iast
Agent [baseline] (1.197 s) : 0, 1196694
Total [baseline] (9.324 s) : 0, 9323696
Agent [candidate] (1.191 s) : 0, 1190544
Total [candidate] (9.281 s) : 0, 9280566
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.063 s -
Agent iast 1.197 s 133.59 ms (12.6%)
Total tracing 8.616 s -
Total iast 9.324 s 707.588 ms (8.2%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.07 s -
Agent iast 1.191 s 120.219 ms (11.2%)
Total tracing 8.633 s -
Total iast 9.281 s 647.213 ms (7.5%)
gantt
    title insecure-bank - break down per module: candidate=1.54.0-SNAPSHOT~eb6874e7eb, baseline=1.54.0-SNAPSHOT~44e5822d88

    dateFormat X
    axisFormat %s
section tracing
crashtracking [baseline] (1.46 ms) : 0, 1460
crashtracking [candidate] (1.466 ms) : 0, 1466
BytebuddyAgent [baseline] (734.072 ms) : 0, 734072
BytebuddyAgent [candidate] (738.765 ms) : 0, 738765
GlobalTracer [baseline] (252.551 ms) : 0, 252551
GlobalTracer [candidate] (254.513 ms) : 0, 254513
AppSec [baseline] (30.741 ms) : 0, 30741
AppSec [candidate] (30.822 ms) : 0, 30822
Debugger [baseline] (6.424 ms) : 0, 6424
Debugger [candidate] (6.505 ms) : 0, 6505
Remote Config [baseline] (701.541 µs) : 0, 702
Remote Config [candidate] (701.093 µs) : 0, 701
Telemetry [baseline] (16.153 ms) : 0, 16153
Telemetry [candidate] (16.43 ms) : 0, 16430
section iast
crashtracking [baseline] (1.475 ms) : 0, 1475
crashtracking [candidate] (1.452 ms) : 0, 1452
BytebuddyAgent [baseline] (858.81 ms) : 0, 858810
BytebuddyAgent [candidate] (852.338 ms) : 0, 852338
GlobalTracer [baseline] (248.312 ms) : 0, 248312
GlobalTracer [candidate] (248.441 ms) : 0, 248441
AppSec [baseline] (24.559 ms) : 0, 24559
AppSec [candidate] (25.539 ms) : 0, 25539
Debugger [baseline] (6.006 ms) : 0, 6006
Debugger [candidate] (5.996 ms) : 0, 5996
Remote Config [baseline] (597.051 µs) : 0, 597
Remote Config [candidate] (601.057 µs) : 0, 601
Telemetry [baseline] (8.161 ms) : 0, 8161
Telemetry [candidate] (8.112 ms) : 0, 8112
IAST [baseline] (27.804 ms) : 0, 27804
IAST [candidate] (27.065 ms) : 0, 27065
Loading

Load

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master bbujon/gateway-inferred-span2
git_commit_date 1758039856 1758040797
git_commit_sha 44e5822 eb6874e
release_version 1.54.0-SNAPSHOT~44e5822d88 1.54.0-SNAPSHOT~eb6874e7eb
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1758042351 1758042351
ci_job_id 1132053611 1132053611
ci_pipeline_id 76644764 76644764
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-m8igv8oz 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-m8igv8oz 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 5 performance regressions! Performance is the same for 7 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:insecure-bank:iast_FULL:high_load worse
[+289.693µs; +897.232µs] or [+2.093%; +6.483%]
unstable
[-53.751op/s; +26.001op/s] or [-15.966%; +7.723%]
14.434ms 322.781op/s 13.841ms 336.656op/s
scenario:load:insecure-bank:profiling:high_load worse
[+268.886µs; +583.223µs] or [+3.011%; +6.532%]
unstable
[-91.424op/s; +44.549op/s] or [-17.593%; +8.573%]
9.355ms 496.219op/s 8.929ms 519.656op/s
scenario:load:insecure-bank:iast_GLOBAL:high_load worse
[+429.144µs; +820.647µs] or [+4.295%; +8.214%]
unstable
[-84.506op/s; +30.318op/s] or [-18.177%; +6.521%]
10.616ms 437.812op/s 9.991ms 464.906op/s
scenario:load:petclinic:appsec:high_load worse
[+2.351ms; +3.268ms] or [+5.015%; +6.972%]
unstable
[-12.588op/s; +1.263op/s] or [-12.609%; +1.265%]
49.693ms 94.175op/s 46.883ms 99.838op/s
scenario:load:petclinic:profiling:high_load worse
[+1.430ms; +2.410ms] or [+3.073%; +5.179%]
unstable
[-11.391op/s; +3.341op/s] or [-11.327%; +3.322%]
48.464ms 96.537op/s 46.544ms 100.562op/s
Request duration reports for petclinic
gantt
    title petclinic - request duration [CI 0.99] : candidate=1.54.0-SNAPSHOT~eb6874e7eb, baseline=1.54.0-SNAPSHOT~44e5822d88
    dateFormat X
    axisFormat %s
section baseline
no_agent (36.203 ms) : 35907, 36498
.   : milestone, 36203,
appsec (46.883 ms) : 46479, 47287
.   : milestone, 46883,
code_origins (45.177 ms) : 44775, 45579
.   : milestone, 45177,
iast (44.319 ms) : 43938, 44700
.   : milestone, 44319,
profiling (46.544 ms) : 46083, 47005
.   : milestone, 46544,
tracing (45.223 ms) : 44848, 45598
.   : milestone, 45223,
section candidate
no_agent (36.505 ms) : 36212, 36799
.   : milestone, 36505,
appsec (49.693 ms) : 49246, 50140
.   : milestone, 49693,
code_origins (44.028 ms) : 43658, 44398
.   : milestone, 44028,
iast (44.19 ms) : 43818, 44563
.   : milestone, 44190,
profiling (48.464 ms) : 48014, 48915
.   : milestone, 48464,
tracing (44.109 ms) : 43720, 44499
.   : milestone, 44109,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 36.203 ms [35.907 ms, 36.498 ms] -
appsec 46.883 ms [46.479 ms, 47.287 ms] 10.681 ms (29.5%)
code_origins 45.177 ms [44.775 ms, 45.579 ms] 8.975 ms (24.8%)
iast 44.319 ms [43.938 ms, 44.7 ms] 8.116 ms (22.4%)
profiling 46.544 ms [46.083 ms, 47.005 ms] 10.342 ms (28.6%)
tracing 45.223 ms [44.848 ms, 45.598 ms] 9.02 ms (24.9%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 36.505 ms [36.212 ms, 36.799 ms] -
appsec 49.693 ms [49.246 ms, 50.14 ms] 13.188 ms (36.1%)
code_origins 44.028 ms [43.658 ms, 44.398 ms] 7.522 ms (20.6%)
iast 44.19 ms [43.818 ms, 44.563 ms] 7.685 ms (21.1%)
profiling 48.464 ms [48.014 ms, 48.915 ms] 11.959 ms (32.8%)
tracing 44.109 ms [43.72 ms, 44.499 ms] 7.604 ms (20.8%)
Request duration reports for insecure-bank
gantt
    title insecure-bank - request duration [CI 0.99] : candidate=1.54.0-SNAPSHOT~eb6874e7eb, baseline=1.54.0-SNAPSHOT~44e5822d88
    dateFormat X
    axisFormat %s
section baseline
no_agent (4.204 ms) : 4156, 4252
.   : milestone, 4204,
iast (9.428 ms) : 9270, 9585
.   : milestone, 9428,
iast_FULL (13.841 ms) : 13565, 14116
.   : milestone, 13841,
iast_GLOBAL (9.991 ms) : 9816, 10166
.   : milestone, 9991,
profiling (8.929 ms) : 8780, 9077
.   : milestone, 8929,
tracing (7.729 ms) : 7619, 7838
.   : milestone, 7729,
section candidate
no_agent (4.31 ms) : 4263, 4358
.   : milestone, 4310,
iast (9.361 ms) : 9206, 9516
.   : milestone, 9361,
iast_FULL (14.434 ms) : 14145, 14723
.   : milestone, 14434,
iast_GLOBAL (10.616 ms) : 10427, 10805
.   : milestone, 10616,
profiling (9.355 ms) : 9211, 9498
.   : milestone, 9355,
tracing (7.777 ms) : 7666, 7887
.   : milestone, 7777,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 4.204 ms [4.156 ms, 4.252 ms] -
iast 9.428 ms [9.27 ms, 9.585 ms] 5.224 ms (124.3%)
iast_FULL 13.841 ms [13.565 ms, 14.116 ms] 9.637 ms (229.2%)
iast_GLOBAL 9.991 ms [9.816 ms, 10.166 ms] 5.787 ms (137.7%)
profiling 8.929 ms [8.78 ms, 9.077 ms] 4.725 ms (112.4%)
tracing 7.729 ms [7.619 ms, 7.838 ms] 3.525 ms (83.8%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 4.31 ms [4.263 ms, 4.358 ms] -
iast 9.361 ms [9.206 ms, 9.516 ms] 5.051 ms (117.2%)
iast_FULL 14.434 ms [14.145 ms, 14.723 ms] 10.124 ms (234.9%)
iast_GLOBAL 10.616 ms [10.427 ms, 10.805 ms] 6.306 ms (146.3%)
profiling 9.355 ms [9.211 ms, 9.498 ms] 5.045 ms (117.0%)
tracing 7.777 ms [7.666 ms, 7.887 ms] 3.466 ms (80.4%)

Dacapo

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master bbujon/gateway-inferred-span2
git_commit_date 1758039856 1758040797
git_commit_sha 44e5822 eb6874e
release_version 1.54.0-SNAPSHOT~44e5822d88 1.54.0-SNAPSHOT~eb6874e7eb
See matching parameters
Baseline Candidate
application biojava biojava
ci_job_date 1758042876 1758042876
ci_job_id 1132053615 1132053615
ci_pipeline_id 76644764 76644764
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-jetahs1b 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-jetahs1b 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 0 performance regressions! Performance is the same for 11 metrics, 0 unstable metrics.

scenario Δ mean execution_time candidate mean execution_time baseline mean execution_time
scenario:dacapo:tomcat:appsec better
[-1.373ms; -1.033ms] or [-37.102%; -27.920%]
2.498ms 3.701ms
Execution time for tomcat
gantt
    title tomcat - execution time [CI 0.99] : candidate=1.54.0-SNAPSHOT~eb6874e7eb, baseline=1.54.0-SNAPSHOT~44e5822d88
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.474 ms) : 1463, 1486
.   : milestone, 1474,
appsec (3.701 ms) : 3484, 3918
.   : milestone, 3701,
iast (2.2 ms) : 2138, 2263
.   : milestone, 2200,
iast_GLOBAL (2.238 ms) : 2174, 2301
.   : milestone, 2238,
profiling (2.038 ms) : 1988, 2089
.   : milestone, 2038,
tracing (2.025 ms) : 1975, 2074
.   : milestone, 2025,
section candidate
no_agent (1.476 ms) : 1464, 1487
.   : milestone, 1476,
appsec (2.498 ms) : 2445, 2550
.   : milestone, 2498,
iast (2.189 ms) : 2126, 2252
.   : milestone, 2189,
iast_GLOBAL (2.239 ms) : 2176, 2303
.   : milestone, 2239,
profiling (2.034 ms) : 1984, 2085
.   : milestone, 2034,
tracing (2.026 ms) : 1977, 2076
.   : milestone, 2026,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.474 ms [1.463 ms, 1.486 ms] -
appsec 3.701 ms [3.484 ms, 3.918 ms] 2.227 ms (151.1%)
iast 2.2 ms [2.138 ms, 2.263 ms] 726.222 µs (49.3%)
iast_GLOBAL 2.238 ms [2.174 ms, 2.301 ms] 763.363 µs (51.8%)
profiling 2.038 ms [1.988 ms, 2.089 ms] 563.995 µs (38.3%)
tracing 2.025 ms [1.975 ms, 2.074 ms] 550.483 µs (37.3%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.476 ms [1.464 ms, 1.487 ms] -
appsec 2.498 ms [2.445 ms, 2.55 ms] 1.022 ms (69.3%)
iast 2.189 ms [2.126 ms, 2.252 ms] 713.463 µs (48.3%)
iast_GLOBAL 2.239 ms [2.176 ms, 2.303 ms] 763.733 µs (51.8%)
profiling 2.034 ms [1.984 ms, 2.085 ms] 558.657 µs (37.9%)
tracing 2.026 ms [1.977 ms, 2.076 ms] 550.587 µs (37.3%)
Execution time for biojava
gantt
    title biojava - execution time [CI 0.99] : candidate=1.54.0-SNAPSHOT~eb6874e7eb, baseline=1.54.0-SNAPSHOT~44e5822d88
    dateFormat X
    axisFormat %s
section baseline
no_agent (14.903 s) : 14903000, 14903000
.   : milestone, 14903000,
appsec (15.004 s) : 15004000, 15004000
.   : milestone, 15004000,
iast (18.864 s) : 18864000, 18864000
.   : milestone, 18864000,
iast_GLOBAL (18.013 s) : 18013000, 18013000
.   : milestone, 18013000,
profiling (15.37 s) : 15370000, 15370000
.   : milestone, 15370000,
tracing (14.924 s) : 14924000, 14924000
.   : milestone, 14924000,
section candidate
no_agent (14.852 s) : 14852000, 14852000
.   : milestone, 14852000,
appsec (14.931 s) : 14931000, 14931000
.   : milestone, 14931000,
iast (18.424 s) : 18424000, 18424000
.   : milestone, 18424000,
iast_GLOBAL (17.956 s) : 17956000, 17956000
.   : milestone, 17956000,
profiling (15.959 s) : 15959000, 15959000
.   : milestone, 15959000,
tracing (15.105 s) : 15105000, 15105000
.   : milestone, 15105000,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 14.903 s [14.903 s, 14.903 s] -
appsec 15.004 s [15.004 s, 15.004 s] 101.0 ms (0.7%)
iast 18.864 s [18.864 s, 18.864 s] 3.961 s (26.6%)
iast_GLOBAL 18.013 s [18.013 s, 18.013 s] 3.11 s (20.9%)
profiling 15.37 s [15.37 s, 15.37 s] 467.0 ms (3.1%)
tracing 14.924 s [14.924 s, 14.924 s] 21.0 ms (0.1%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 14.852 s [14.852 s, 14.852 s] -
appsec 14.931 s [14.931 s, 14.931 s] 79.0 ms (0.5%)
iast 18.424 s [18.424 s, 18.424 s] 3.572 s (24.1%)
iast_GLOBAL 17.956 s [17.956 s, 17.956 s] 3.104 s (20.9%)
profiling 15.959 s [15.959 s, 15.959 s] 1.107 s (7.5%)
tracing 15.105 s [15.105 s, 15.105 s] 253.0 ms (1.7%)

@PerfectSlayer PerfectSlayer marked this pull request as ready for review August 21, 2025 07:23
@PerfectSlayer PerfectSlayer requested review from a team as code owners August 21, 2025 07:23
@PerfectSlayer PerfectSlayer removed the tag: do not merge Do not merge changes label Aug 21, 2025
@PerfectSlayer PerfectSlayer force-pushed the bbujon/gateway-inferred-span2 branch 2 times, most recently from ad6356f to e8c2baf Compare August 21, 2025 07:53
@PerfectSlayer PerfectSlayer requested a review from a team as a code owner August 21, 2025 07:53
@PerfectSlayer PerfectSlayer requested review from AlexeyKuznetsov-DD and removed request for a team August 21, 2025 07:53
Comment on lines +65 to +70
long startTime;
try {
startTime = Long.parseLong(header(PROXY_START_TIME_MS)) * 1000; // Convert to microseconds
} catch (NumberFormatException e) {
return extracted; // Invalid timestamp
}
Copy link
Contributor

@AlexeyKuznetsov-DD AlexeyKuznetsov-DD Aug 26, 2025

Choose a reason for hiding this comment

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

I have a feeling that we need to have some sort of utility code for such places?
WDYT?
Something like: long startTime = parseLong((header(PROXY_START_TIME_MS), ?some_default? ) * 1000;

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 don't think you can have a default start time in this case.

Gateway inferred spans represent the duration spent in upstream proxy servers (that are not instrumented for distributed tracing, they only inject few Datadog headers).
The start time represents the timestamp the request was intercepted by the proxy server and will be use to create a "proxy span" into the downstream service.

So if you don't have a valid start time, it's most likely a proxy issue, and you can't really "guess" when the proxy intercepted the upstream request.

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.

The change looks good. May we keep settings tags in a decorator to be sure we are consistent with other part of the code?

tracer().getDataStreamsMonitoring().setCheckpoint(span, forHttpServer());
}
// DSM Checkpoint
tracer().getDataStreamsMonitoring().setCheckpoint(span, forHttpServer());
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this change related to inferred span?

Copy link
Contributor Author

@PerfectSlayer PerfectSlayer Sep 16, 2025

Choose a reason for hiding this comment

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

No, carrier and getter aren’t used so it’s only an optimization of not checking them. And disabled DSM will call a noop implementation.

String proxy = SUPPORTED_PROXIES.get(proxySystem);
AgentSpan span = AgentTracer.get().startSpan(INSTRUMENTATION_NAME, proxy, extracted, startTime);

span.setTag(COMPONENT, proxySystem);
Copy link
Contributor

Choose a reason for hiding this comment

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

should we have a decorator setting all those properties?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What kind of decorator do you have in mind?
InferredProxySpan are only created from the HttpServerDecorator and are "product spans" directly created from the serverless product.

@PerfectSlayer PerfectSlayer force-pushed the bbujon/gateway-inferred-span2 branch from e8c2baf to e73fcc3 Compare September 16, 2025 13:50
jordan-wong and others added 2 commits September 16, 2025 18:38
* Creates inferred proxy spans for API Gateway calls via presence of http headers

---------

Co-authored-by: Zarir Hamza <[email protected]>
Avoid duplicate expensive context extraction
Avoid subclassing tracing span for serverless but used serverless context element instead to store / track inferred span while keep tracing feature untouched
Improved propagator to not create / capture inferred span context element on invalid data
Rework context element to hold the inferred spans and its captured data
Release captured data as soon as they span start (never read after this point so reclaiming memory)
Refactor context element and propagator into the right package, not context component (product / feature agnostic)
Refactor unit tests
@PerfectSlayer PerfectSlayer force-pushed the bbujon/gateway-inferred-span2 branch from e73fcc3 to eb6874e Compare September 16, 2025 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inst: others All other instrumentations tag: serverless Serverless support type: refactoring
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants