Skip to content

Notify listeners when the scope top changes after switching scope stacks #8797

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

Merged
merged 1 commit into from
May 12, 2025

Conversation

mcculls
Copy link
Contributor

@mcculls mcculls commented May 11, 2025

Motivation

We should notify registered listeners when the scope changes after switching the scope stack for coroutines or fibers - previously we switched scope stacks without notifying listeners. (This includes notifying the profiling integration that the context has switched for this thread.)

Note that switching the scope stack doesn't imply the previous scope was closed - the ScopeListener javadoc clearly states that there may be many calls to afterScopeActivated as the context flows between parent and child scopes and back again. Switching between coroutines should therefore also trigger afterScopeActivated.

Contributor Checklist

Jira ticket: [PROJ-IDENT]

@mcculls mcculls marked this pull request as ready for review May 11, 2025 18:22
@mcculls mcculls requested a review from a team as a code owner May 11, 2025 18:22
@pr-commenter
Copy link

pr-commenter bot commented May 11, 2025

Benchmarks

Startup

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master mcculls/notify-listeners-when-swapping-scope-stacks
git_commit_date 1746825821 1746987047
git_commit_sha f494c33 a3a1feb
release_version 1.50.0-SNAPSHOT~f494c33b01 1.50.0-SNAPSHOT~a3a1febb38
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1746989374 1746989374
ci_job_id 932711607 932711607
ci_pipeline_id 64732960 64732960
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-ebcu-tmw-project-304-concurrent-0-bkadvncc 6.8.0-1027-aws #29~22.04.1-Ubuntu SMP Sun Mar 30 07:45:38 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-ebcu-tmw-project-304-concurrent-0-bkadvncc 6.8.0-1027-aws #29~22.04.1-Ubuntu SMP Sun Mar 30 07:45:38 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
module Agent Agent
parent None None
variant iast iast

Summary

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

Startup time reports for insecure-bank
gantt
    title insecure-bank - global startup overhead: candidate=1.50.0-SNAPSHOT~a3a1febb38, baseline=1.50.0-SNAPSHOT~f494c33b01

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.019 s) : 0, 1018539
Total [baseline] (8.656 s) : 0, 8656267
Agent [candidate] (1.022 s) : 0, 1022396
Total [candidate] (8.652 s) : 0, 8651806
section iast
Agent [baseline] (1.146 s) : 0, 1146055
Total [baseline] (9.184 s) : 0, 9184215
Agent [candidate] (1.159 s) : 0, 1158815
Total [candidate] (9.225 s) : 0, 9225101
section iast_HARDCODED_SECRET_DISABLED
Agent [baseline] (1.154 s) : 0, 1154240
Total [baseline] (9.205 s) : 0, 9205176
Agent [candidate] (1.147 s) : 0, 1146821
Total [candidate] (9.177 s) : 0, 9177448
section iast_TELEMETRY_OFF
Agent [baseline] (1.162 s) : 0, 1161934
Total [baseline] (9.268 s) : 0, 9267782
Agent [candidate] (1.143 s) : 0, 1142818
Total [candidate] (9.269 s) : 0, 9268649
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.019 s -
Agent iast 1.146 s 127.515 ms (12.5%)
Agent iast_HARDCODED_SECRET_DISABLED 1.154 s 135.701 ms (13.3%)
Agent iast_TELEMETRY_OFF 1.162 s 143.395 ms (14.1%)
Total tracing 8.656 s -
Total iast 9.184 s 527.948 ms (6.1%)
Total iast_HARDCODED_SECRET_DISABLED 9.205 s 548.909 ms (6.3%)
Total iast_TELEMETRY_OFF 9.268 s 611.515 ms (7.1%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.022 s -
Agent iast 1.159 s 136.42 ms (13.3%)
Agent iast_HARDCODED_SECRET_DISABLED 1.147 s 124.425 ms (12.2%)
Agent iast_TELEMETRY_OFF 1.143 s 120.422 ms (11.8%)
Total tracing 8.652 s -
Total iast 9.225 s 573.295 ms (6.6%)
Total iast_HARDCODED_SECRET_DISABLED 9.177 s 525.642 ms (6.1%)
Total iast_TELEMETRY_OFF 9.269 s 616.842 ms (7.1%)
gantt
    title insecure-bank - break down per module: candidate=1.50.0-SNAPSHOT~a3a1febb38, baseline=1.50.0-SNAPSHOT~f494c33b01

    dateFormat X
    axisFormat %s
section tracing
BytebuddyAgent [baseline] (680.729 ms) : 0, 680729
BytebuddyAgent [candidate] (683.727 ms) : 0, 683727
GlobalTracer [baseline] (239.416 ms) : 0, 239416
GlobalTracer [candidate] (240.421 ms) : 0, 240421
AppSec [baseline] (55.2 ms) : 0, 55200
AppSec [candidate] (55.015 ms) : 0, 55015
Debugger [baseline] (10.577 ms) : 0, 10577
Debugger [candidate] (9.908 ms) : 0, 9908
Remote Config [baseline] (713.911 µs) : 0, 714
Remote Config [candidate] (693.213 µs) : 0, 693
Telemetry [baseline] (8.269 ms) : 0, 8269
Telemetry [candidate] (8.992 ms) : 0, 8992
section iast
BytebuddyAgent [baseline] (800.246 ms) : 0, 800246
BytebuddyAgent [candidate] (809.338 ms) : 0, 809338
GlobalTracer [baseline] (229.625 ms) : 0, 229625
GlobalTracer [candidate] (232.057 ms) : 0, 232057
AppSec [baseline] (50.131 ms) : 0, 50131
AppSec [candidate] (51.397 ms) : 0, 51397
Debugger [baseline] (5.893 ms) : 0, 5893
Debugger [candidate] (5.933 ms) : 0, 5933
Remote Config [baseline] (590.09 µs) : 0, 590
Remote Config [candidate] (594.788 µs) : 0, 595
Telemetry [baseline] (7.857 ms) : 0, 7857
Telemetry [candidate] (7.967 ms) : 0, 7967
IAST [baseline] (28.232 ms) : 0, 28232
IAST [candidate] (27.833 ms) : 0, 27833
section iast_HARDCODED_SECRET_DISABLED
BytebuddyAgent [baseline] (803.82 ms) : 0, 803820
BytebuddyAgent [candidate] (799.904 ms) : 0, 799904
GlobalTracer [baseline] (232.602 ms) : 0, 232602
GlobalTracer [candidate] (230.397 ms) : 0, 230397
AppSec [baseline] (51.809 ms) : 0, 51809
AppSec [candidate] (51.033 ms) : 0, 51033
Debugger [baseline] (5.988 ms) : 0, 5988
Debugger [candidate] (5.908 ms) : 0, 5908
Remote Config [baseline] (608.944 µs) : 0, 609
Remote Config [candidate] (594.833 µs) : 0, 595
Telemetry [baseline] (8.021 ms) : 0, 8021
Telemetry [candidate] (7.909 ms) : 0, 7909
IAST [baseline] (27.787 ms) : 0, 27787
IAST [candidate] (27.585 ms) : 0, 27585
section iast_TELEMETRY_OFF
BytebuddyAgent [baseline] (809.388 ms) : 0, 809388
BytebuddyAgent [candidate] (796.991 ms) : 0, 796991
GlobalTracer [baseline] (234.272 ms) : 0, 234272
GlobalTracer [candidate] (230.096 ms) : 0, 230096
AppSec [baseline] (56.102 ms) : 0, 56102
AppSec [candidate] (55.734 ms) : 0, 55734
Debugger [baseline] (6.147 ms) : 0, 6147
Debugger [candidate] (5.93 ms) : 0, 5930
Remote Config [baseline] (630.76 µs) : 0, 631
Remote Config [candidate] (607.032 µs) : 0, 607
Telemetry [baseline] (7.969 ms) : 0, 7969
Telemetry [candidate] (7.792 ms) : 0, 7792
IAST [baseline] (23.665 ms) : 0, 23665
IAST [candidate] (22.264 ms) : 0, 22264
Loading
Startup time reports for petclinic
gantt
    title petclinic - global startup overhead: candidate=1.50.0-SNAPSHOT~a3a1febb38, baseline=1.50.0-SNAPSHOT~f494c33b01

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.027 s) : 0, 1027102
Total [baseline] (10.487 s) : 0, 10486908
Agent [candidate] (1.023 s) : 0, 1022774
Total [candidate] (10.498 s) : 0, 10497786
section appsec
Agent [baseline] (1.16 s) : 0, 1160093
Total [baseline] (10.697 s) : 0, 10696637
Agent [candidate] (1.167 s) : 0, 1166855
Total [candidate] (10.718 s) : 0, 10718101
section iast
Agent [baseline] (1.147 s) : 0, 1147112
Total [baseline] (10.903 s) : 0, 10903344
Agent [candidate] (1.149 s) : 0, 1149369
Total [candidate] (10.883 s) : 0, 10882745
section profiling
Agent [baseline] (1.283 s) : 0, 1283097
Total [baseline] (10.927 s) : 0, 10926562
Agent [candidate] (1.281 s) : 0, 1280953
Total [candidate] (10.927 s) : 0, 10927310
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.027 s -
Agent appsec 1.16 s 132.991 ms (12.9%)
Agent iast 1.147 s 120.01 ms (11.7%)
Agent profiling 1.283 s 255.995 ms (24.9%)
Total tracing 10.487 s -
Total appsec 10.697 s 209.729 ms (2.0%)
Total iast 10.903 s 416.436 ms (4.0%)
Total profiling 10.927 s 439.655 ms (4.2%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.023 s -
Agent appsec 1.167 s 144.081 ms (14.1%)
Agent iast 1.149 s 126.595 ms (12.4%)
Agent profiling 1.281 s 258.179 ms (25.2%)
Total tracing 10.498 s -
Total appsec 10.718 s 220.316 ms (2.1%)
Total iast 10.883 s 384.959 ms (3.7%)
Total profiling 10.927 s 429.524 ms (4.1%)
gantt
    title petclinic - break down per module: candidate=1.50.0-SNAPSHOT~a3a1febb38, baseline=1.50.0-SNAPSHOT~f494c33b01

    dateFormat X
    axisFormat %s
section tracing
BytebuddyAgent [baseline] (689.148 ms) : 0, 689148
BytebuddyAgent [candidate] (686.44 ms) : 0, 686440
GlobalTracer [baseline] (241.979 ms) : 0, 241979
GlobalTracer [candidate] (240.134 ms) : 0, 240134
AppSec [baseline] (55.066 ms) : 0, 55066
AppSec [candidate] (55.074 ms) : 0, 55074
Debugger [baseline] (7.024 ms) : 0, 7024
Debugger [candidate] (7.613 ms) : 0, 7613
Remote Config [baseline] (715.822 µs) : 0, 716
Remote Config [candidate] (685.131 µs) : 0, 685
Telemetry [baseline] (9.429 ms) : 0, 9429
Telemetry [candidate] (9.189 ms) : 0, 9189
section appsec
BytebuddyAgent [baseline] (700.234 ms) : 0, 700234
BytebuddyAgent [candidate] (703.957 ms) : 0, 703957
GlobalTracer [baseline] (236.046 ms) : 0, 236046
GlobalTracer [candidate] (237.816 ms) : 0, 237816
AppSec [baseline] (175.241 ms) : 0, 175241
AppSec [candidate] (175.466 ms) : 0, 175466
Debugger [baseline] (5.914 ms) : 0, 5914
Debugger [candidate] (5.969 ms) : 0, 5969
Remote Config [baseline] (624.472 µs) : 0, 624
Remote Config [candidate] (625.082 µs) : 0, 625
Telemetry [baseline] (7.704 ms) : 0, 7704
Telemetry [candidate] (8.565 ms) : 0, 8565
IAST [baseline] (21.576 ms) : 0, 21576
IAST [candidate] (21.669 ms) : 0, 21669
section iast
BytebuddyAgent [baseline] (800.88 ms) : 0, 800880
BytebuddyAgent [candidate] (802.232 ms) : 0, 802232
GlobalTracer [baseline] (229.992 ms) : 0, 229992
GlobalTracer [candidate] (230.613 ms) : 0, 230613
AppSec [baseline] (48.525 ms) : 0, 48525
AppSec [candidate] (49.487 ms) : 0, 49487
Debugger [baseline] (5.925 ms) : 0, 5925
Debugger [candidate] (5.929 ms) : 0, 5929
Remote Config [baseline] (611.28 µs) : 0, 611
Remote Config [candidate] (601.444 µs) : 0, 601
Telemetry [baseline] (7.929 ms) : 0, 7929
Telemetry [candidate] (7.938 ms) : 0, 7938
IAST [baseline] (28.192 ms) : 0, 28192
IAST [candidate] (28.25 ms) : 0, 28250
section profiling
BytebuddyAgent [baseline] (673.645 ms) : 0, 673645
BytebuddyAgent [candidate] (673.031 ms) : 0, 673031
GlobalTracer [baseline] (379.742 ms) : 0, 379742
GlobalTracer [candidate] (377.731 ms) : 0, 377731
AppSec [baseline] (54.675 ms) : 0, 54675
AppSec [candidate] (53.737 ms) : 0, 53737
Debugger [baseline] (6.143 ms) : 0, 6143
Debugger [candidate] (6.103 ms) : 0, 6103
Remote Config [baseline] (659.878 µs) : 0, 660
Remote Config [candidate] (665.551 µs) : 0, 666
Telemetry [baseline] (8.196 ms) : 0, 8196
Telemetry [candidate] (8.108 ms) : 0, 8108
ProfilingAgent [baseline] (109.439 ms) : 0, 109439
ProfilingAgent [candidate] (110.902 ms) : 0, 110902
Profiling [baseline] (109.464 ms) : 0, 109464
Profiling [candidate] (110.928 ms) : 0, 110928
Loading

Load

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
end_time 2025-05-11T18:22:01 2025-05-11T18:29:49
git_branch master mcculls/notify-listeners-when-swapping-scope-stacks
git_commit_date 1746825821 1746987047
git_commit_sha f494c33 a3a1feb
release_version 1.50.0-SNAPSHOT~f494c33b01 1.50.0-SNAPSHOT~a3a1febb38
start_time 2025-05-11T18:21:47 2025-05-11T18:29:35
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1746988590 1746988590
ci_job_id 932711608 932711608
ci_pipeline_id 64732960 64732960
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-i83qnnyx-project-304-concurrent-1-qzp1kcvq 6.8.0-1027-aws #29~22.04.1-Ubuntu SMP Sun Mar 30 07:45:38 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-i83qnnyx-project-304-concurrent-1-qzp1kcvq 6.8.0-1027-aws #29~22.04.1-Ubuntu SMP Sun Mar 30 07:45:38 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 insecure-bank
gantt
    title insecure-bank - request duration [CI 0.99] : candidate=1.50.0-SNAPSHOT~a3a1febb38, baseline=1.50.0-SNAPSHOT~f494c33b01
    dateFormat X
    axisFormat %s
section baseline
no_agent (383.098 µs) : 363, 403
.   : milestone, 383,
iast (524.955 µs) : 503, 547
.   : milestone, 525,
iast_FULL (742.286 µs) : 720, 764
.   : milestone, 742,
iast_GLOBAL (563.689 µs) : 542, 585
.   : milestone, 564,
iast_HARDCODED_SECRET_DISABLED (523.282 µs) : 500, 546
.   : milestone, 523,
iast_INACTIVE (473.343 µs) : 450, 496
.   : milestone, 473,
iast_TELEMETRY_OFF (509.799 µs) : 487, 533
.   : milestone, 510,
tracing (464.312 µs) : 442, 486
.   : milestone, 464,
section candidate
no_agent (380.687 µs) : 361, 401
.   : milestone, 381,
iast (525.778 µs) : 502, 549
.   : milestone, 526,
iast_FULL (742.048 µs) : 720, 764
.   : milestone, 742,
iast_GLOBAL (566.061 µs) : 545, 588
.   : milestone, 566,
iast_HARDCODED_SECRET_DISABLED (528.352 µs) : 506, 551
.   : milestone, 528,
iast_INACTIVE (478.608 µs) : 456, 501
.   : milestone, 479,
iast_TELEMETRY_OFF (519.474 µs) : 497, 542
.   : milestone, 519,
tracing (464.095 µs) : 442, 486
.   : milestone, 464,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 383.098 µs [363.466 µs, 402.73 µs] -
iast 524.955 µs [503.251 µs, 546.66 µs] 141.857 µs (37.0%)
iast_FULL 742.286 µs [720.332 µs, 764.24 µs] 359.187 µs (93.8%)
iast_GLOBAL 563.689 µs [542.066 µs, 585.313 µs] 180.591 µs (47.1%)
iast_HARDCODED_SECRET_DISABLED 523.282 µs [500.136 µs, 546.428 µs] 140.184 µs (36.6%)
iast_INACTIVE 473.343 µs [450.412 µs, 496.274 µs] 90.245 µs (23.6%)
iast_TELEMETRY_OFF 509.799 µs [486.821 µs, 532.778 µs] 126.701 µs (33.1%)
tracing 464.312 µs [442.343 µs, 486.281 µs] 81.214 µs (21.2%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 380.687 µs [360.596 µs, 400.778 µs] -
iast 525.778 µs [502.357 µs, 549.199 µs] 145.091 µs (38.1%)
iast_FULL 742.048 µs [719.943 µs, 764.154 µs] 361.361 µs (94.9%)
iast_GLOBAL 566.061 µs [544.573 µs, 587.549 µs] 185.374 µs (48.7%)
iast_HARDCODED_SECRET_DISABLED 528.352 µs [505.984 µs, 550.719 µs] 147.665 µs (38.8%)
iast_INACTIVE 478.608 µs [455.83 µs, 501.387 µs] 97.921 µs (25.7%)
iast_TELEMETRY_OFF 519.474 µs [496.516 µs, 542.433 µs] 138.787 µs (36.5%)
tracing 464.095 µs [441.858 µs, 486.332 µs] 83.408 µs (21.9%)
Request duration reports for petclinic
gantt
    title petclinic - request duration [CI 0.99] : candidate=1.50.0-SNAPSHOT~a3a1febb38, baseline=1.50.0-SNAPSHOT~f494c33b01
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.379 ms) : 1359, 1398
.   : milestone, 1379,
appsec (1.739 ms) : 1716, 1763
.   : milestone, 1739,
appsec_no_iast (1.74 ms) : 1716, 1763
.   : milestone, 1740,
code_origins (1.672 ms) : 1645, 1699
.   : milestone, 1672,
iast (1.533 ms) : 1509, 1557
.   : milestone, 1533,
profiling (1.599 ms) : 1575, 1623
.   : milestone, 1599,
tracing (1.51 ms) : 1486, 1534
.   : milestone, 1510,
section candidate
no_agent (1.367 ms) : 1348, 1386
.   : milestone, 1367,
appsec (1.735 ms) : 1712, 1759
.   : milestone, 1735,
appsec_no_iast (1.751 ms) : 1727, 1775
.   : milestone, 1751,
code_origins (1.683 ms) : 1655, 1710
.   : milestone, 1683,
iast (1.527 ms) : 1503, 1551
.   : milestone, 1527,
profiling (1.572 ms) : 1548, 1597
.   : milestone, 1572,
tracing (1.507 ms) : 1483, 1531
.   : milestone, 1507,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 1.379 ms [1.359 ms, 1.398 ms] -
appsec 1.739 ms [1.716 ms, 1.763 ms] 360.566 µs (26.1%)
appsec_no_iast 1.74 ms [1.716 ms, 1.763 ms] 360.779 µs (26.2%)
code_origins 1.672 ms [1.645 ms, 1.699 ms] 293.045 µs (21.3%)
iast 1.533 ms [1.509 ms, 1.557 ms] 154.068 µs (11.2%)
profiling 1.599 ms [1.575 ms, 1.623 ms] 220.414 µs (16.0%)
tracing 1.51 ms [1.486 ms, 1.534 ms] 131.015 µs (9.5%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 1.367 ms [1.348 ms, 1.386 ms] -
appsec 1.735 ms [1.712 ms, 1.759 ms] 367.795 µs (26.9%)
appsec_no_iast 1.751 ms [1.727 ms, 1.775 ms] 383.87 µs (28.1%)
code_origins 1.683 ms [1.655 ms, 1.71 ms] 315.123 µs (23.0%)
iast 1.527 ms [1.503 ms, 1.551 ms] 159.557 µs (11.7%)
profiling 1.572 ms [1.548 ms, 1.597 ms] 204.932 µs (15.0%)
tracing 1.507 ms [1.483 ms, 1.531 ms] 139.624 µs (10.2%)

Dacapo

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master mcculls/notify-listeners-when-swapping-scope-stacks
git_commit_date 1746825821 1746987047
git_commit_sha f494c33 a3a1feb
release_version 1.50.0-SNAPSHOT~f494c33b01 1.50.0-SNAPSHOT~a3a1febb38
See matching parameters
Baseline Candidate
application biojava biojava
ci_job_date 1746989124 1746989124
ci_job_id 932711609 932711609
ci_pipeline_id 64732960 64732960
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-ebcu-tmw-project-304-concurrent-1-7gwtkr08 6.8.0-1027-aws #29~22.04.1-Ubuntu SMP Sun Mar 30 07:45:38 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-ebcu-tmw-project-304-concurrent-1-7gwtkr08 6.8.0-1027-aws #29~22.04.1-Ubuntu SMP Sun Mar 30 07:45:38 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 biojava
gantt
    title biojava - execution time [CI 0.99] : candidate=1.50.0-SNAPSHOT~a3a1febb38, baseline=1.50.0-SNAPSHOT~f494c33b01
    dateFormat X
    axisFormat %s
section baseline
no_agent (14.93 s) : 14930000, 14930000
.   : milestone, 14930000,
appsec (15.299 s) : 15299000, 15299000
.   : milestone, 15299000,
iast (19.207 s) : 19207000, 19207000
.   : milestone, 19207000,
iast_GLOBAL (18.27 s) : 18270000, 18270000
.   : milestone, 18270000,
profiling (14.882 s) : 14882000, 14882000
.   : milestone, 14882000,
tracing (15.133 s) : 15133000, 15133000
.   : milestone, 15133000,
section candidate
no_agent (15.455 s) : 15455000, 15455000
.   : milestone, 15455000,
appsec (14.891 s) : 14891000, 14891000
.   : milestone, 14891000,
iast (19.016 s) : 19016000, 19016000
.   : milestone, 19016000,
iast_GLOBAL (18.242 s) : 18242000, 18242000
.   : milestone, 18242000,
profiling (14.918 s) : 14918000, 14918000
.   : milestone, 14918000,
tracing (14.795 s) : 14795000, 14795000
.   : milestone, 14795000,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 14.93 s [14.93 s, 14.93 s] -
appsec 15.299 s [15.299 s, 15.299 s] 369.0 ms (2.5%)
iast 19.207 s [19.207 s, 19.207 s] 4.277 s (28.6%)
iast_GLOBAL 18.27 s [18.27 s, 18.27 s] 3.34 s (22.4%)
profiling 14.882 s [14.882 s, 14.882 s] -48.0 ms (-0.3%)
tracing 15.133 s [15.133 s, 15.133 s] 203.0 ms (1.4%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 15.455 s [15.455 s, 15.455 s] -
appsec 14.891 s [14.891 s, 14.891 s] -564.0 ms (-3.6%)
iast 19.016 s [19.016 s, 19.016 s] 3.561 s (23.0%)
iast_GLOBAL 18.242 s [18.242 s, 18.242 s] 2.787 s (18.0%)
profiling 14.918 s [14.918 s, 14.918 s] -537.0 ms (-3.5%)
tracing 14.795 s [14.795 s, 14.795 s] -660.0 ms (-4.3%)
Execution time for tomcat
gantt
    title tomcat - execution time [CI 0.99] : candidate=1.50.0-SNAPSHOT~a3a1febb38, baseline=1.50.0-SNAPSHOT~f494c33b01
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.484 ms) : 1472, 1495
.   : milestone, 1484,
appsec (2.416 ms) : 2368, 2465
.   : milestone, 2416,
iast (2.206 ms) : 2143, 2268
.   : milestone, 2206,
iast_GLOBAL (2.251 ms) : 2188, 2315
.   : milestone, 2251,
profiling (2.051 ms) : 2002, 2101
.   : milestone, 2051,
tracing (2.043 ms) : 1994, 2092
.   : milestone, 2043,
section candidate
no_agent (1.483 ms) : 1471, 1495
.   : milestone, 1483,
appsec (2.425 ms) : 2376, 2474
.   : milestone, 2425,
iast (2.204 ms) : 2141, 2266
.   : milestone, 2204,
iast_GLOBAL (2.247 ms) : 2185, 2310
.   : milestone, 2247,
profiling (2.047 ms) : 1997, 2097
.   : milestone, 2047,
tracing (2.021 ms) : 1973, 2070
.   : milestone, 2021,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.484 ms [1.472 ms, 1.495 ms] -
appsec 2.416 ms [2.368 ms, 2.465 ms] 932.722 µs (62.9%)
iast 2.206 ms [2.143 ms, 2.268 ms] 722.075 µs (48.7%)
iast_GLOBAL 2.251 ms [2.188 ms, 2.315 ms] 767.775 µs (51.7%)
profiling 2.051 ms [2.002 ms, 2.101 ms] 567.736 µs (38.3%)
tracing 2.043 ms [1.994 ms, 2.092 ms] 559.441 µs (37.7%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.483 ms [1.471 ms, 1.495 ms] -
appsec 2.425 ms [2.376 ms, 2.474 ms] 942.011 µs (63.5%)
iast 2.204 ms [2.141 ms, 2.266 ms] 720.665 µs (48.6%)
iast_GLOBAL 2.247 ms [2.185 ms, 2.31 ms] 764.147 µs (51.5%)
profiling 2.047 ms [1.997 ms, 2.097 ms] 563.813 µs (38.0%)
tracing 2.021 ms [1.973 ms, 2.07 ms] 538.497 µs (36.3%)

tlsScopeStack.set(localScopeStack);
ContinuableScope newScope = localScopeStack.top;
if (oldScope != newScope && newScope != null) {
newScope.beforeActivated();
Copy link
Collaborator

Choose a reason for hiding this comment

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

we call before and after on a row without doing anything in between. Can this be simplified ?

Copy link
Contributor Author

@mcculls mcculls May 12, 2025

Choose a reason for hiding this comment

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

There's a very subtle difference - beforeActivated calls the profiling integration, while afterActivated calls the registered listeners.

In one place in the code beforeActivated is called before changing the top value:

scope.beforeActivated();
if (top != null) {
stack.push(top);
} else {
onBecomeNonEmpty();
}
top = scope;
scope.afterActivated();

but in another part of the code, they are called at the same time after the top has changed:

curScope.beforeActivated();
curScope.afterActivated();

In terms of actual implementation the profiling integration is just clearing some caches, so there is flexibility here and this could all be done in one method as long as the profiling integration is always called first.

However since the profiling integration will need to be refactored to make it context-first, that's something I will do in a separate PR.

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 for now, but as you said, we will need to rework product integration in a second phase. Let me know if you want help with this part 🤝

@mcculls mcculls merged commit c35c5cc into master May 12, 2025
599 of 600 checks passed
@mcculls mcculls deleted the mcculls/notify-listeners-when-swapping-scope-stacks branch May 12, 2025 09:22
@github-actions github-actions bot added this to the 1.50.0 milestone May 12, 2025
svc-squareup-copybara pushed a commit to cashapp/misk that referenced this pull request Jun 20, 2025
| Package | Type | Package file | Manager | Update | Change |
|---|---|---|---|---|---|
| [com.datadoghq:dd-trace-api](https://github.com/datadog/dd-trace-java)
| dependencies | misk/gradle/libs.versions.toml | gradle | minor |
`1.49.0` -> `1.50.0` |

---

### Release Notes

<details>
<summary>datadog/dd-trace-java (com.datadoghq:dd-trace-api)</summary>

###
[`v1.50.0`](https://github.com/DataDog/dd-trace-java/releases/tag/v1.50.0):
1.50.0

### Deprecation Notice

> \[!NOTE]
> `DD_RUNTIME_ID_ENABLED` has been deprecated and will be removed in
future releases. Please use `DD_RUNTIME_METRICS_RUNTIME_ID_ENABLED`
instead.

### Components

#### Application Security Management (WAF)

- 🐛 Add String length truncation limit to ObjectIntrospector and
update truncation metrics
([#&#8203;8825](DataDog/dd-trace-java#8825) -
[@&#8203;jandro996](https://github.com/jandro996))
- 🐛 Adapt standalone ASM to support API Security
([#&#8203;8804](DataDog/dd-trace-java#8804) -
[@&#8203;jandro996](https://github.com/jandro996))
- ✨ Add appsec.waf.input\_truncated metric
([#&#8203;8791](DataDog/dd-trace-java#8791) -
[@&#8203;jandro996](https://github.com/jandro996))
- ✨ Extended appsec request body collection
([#&#8203;8748](DataDog/dd-trace-java#8748) -
[@&#8203;jandro996](https://github.com/jandro996))
- ✨ Extended appsec request/response headers collection
([#&#8203;8724](DataDog/dd-trace-java#8724) -
[@&#8203;jandro996](https://github.com/jandro996))

#### Build & Tooling

- ✨ Add artifacts to public s3 bucket
([#&#8203;8947](DataDog/dd-trace-java#8947) -
[@&#8203;randomanderson](https://github.com/randomanderson))

#### Continuous Integration Visibility

- ✨ Improve PR information building
([#&#8203;8908](DataDog/dd-trace-java#8908) -
[@&#8203;daniel-mohedano](https://github.com/daniel-mohedano))
- ✨ Truncate span stack traces when Test Optimization is
enabled
([#&#8203;8903](DataDog/dd-trace-java#8903) -
[@&#8203;nikita-tkachenko-datadog](https://github.com/nikita-tkachenko-datadog))
- 🐛 Ensure auto-detected service name is the same for every process
in the same build
([#&#8203;8902](DataDog/dd-trace-java#8902) -
[@&#8203;nikita-tkachenko-datadog](https://github.com/nikita-tkachenko-datadog))
- 🐛 Use tag as fallback in api requests if no branch is available
([#&#8203;8876](DataDog/dd-trace-java#8876) -
[@&#8203;daniel-mohedano](https://github.com/daniel-mohedano))
- ✨ Add support for JUnit 5.13-RC1
([#&#8203;8865](DataDog/dd-trace-java#8865),
[#&#8203;8871](DataDog/dd-trace-java#8871) -
[@&#8203;daniel-mohedano](https://github.com/daniel-mohedano))
- ✨ Implement attempt to fix v3 and v4 and bump capability
version
([#&#8203;8824](DataDog/dd-trace-java#8824) -
[@&#8203;daniel-mohedano](https://github.com/daniel-mohedano))
- 🧹 Align retry logic for all test framework instrumentations
([#&#8203;8803](DataDog/dd-trace-java#8803) -
[@&#8203;daniel-mohedano](https://github.com/daniel-mohedano))
- 🐛 Always build ci workspace without trailing separator
([#&#8203;8788](DataDog/dd-trace-java#8788) -
[@&#8203;daniel-mohedano](https://github.com/daniel-mohedano))
- ✨ Add commit discrepancies telemetry when building repository
git information
([#&#8203;8763](DataDog/dd-trace-java#8763) -
[@&#8203;daniel-mohedano](https://github.com/daniel-mohedano))

#### Data Streams Monitoring

- 💡 Surface process tags in dsm payloads and use them for base hash
calculation
([#&#8203;8836](DataDog/dd-trace-java#8836) -
[@&#8203;amarziali](https://github.com/amarziali))

#### Dynamic Instrumentation

- ✨ Optimized allocations for collection filter functions
([#&#8203;8896](DataDog/dd-trace-java#8896) -
[@&#8203;jpbempel](https://github.com/jpbempel))
- 🐛 Fix SymDB upload size check
([#&#8203;8887](DataDog/dd-trace-java#8887) -
[@&#8203;jpbempel](https://github.com/jpbempel))
- 🐛 Add support for Set in filter function
([#&#8203;8873](DataDog/dd-trace-java#8873) -
[@&#8203;jpbempel](https://github.com/jpbempel))
- 🐛 Add support for isDefined in log template
([#&#8203;8859](DataDog/dd-trace-java#8859) -
[@&#8203;jpbempel](https://github.com/jpbempel))
- 🐛 Fix Max captured frames for Exception Replay
([#&#8203;8856](DataDog/dd-trace-java#8856) -
[@&#8203;jpbempel](https://github.com/jpbempel))
- 🐛 Remove static inherited fields collection
([#&#8203;8832](DataDog/dd-trace-java#8832) -
[@&#8203;jpbempel](https://github.com/jpbempel))
- 💡 Add process tags to dynamic instrumentation intake payload
([#&#8203;8779](DataDog/dd-trace-java#8779) -
[@&#8203;amarziali](https://github.com/amarziali))

#### GraalVM native-image

- ✨ Add support for GraalVM Native GC metrics
([#&#8203;8913](DataDog/dd-trace-java#8913) -
[@&#8203;ygree](https://github.com/ygree))
- ✨ Add JMXFetch support for GraalVM Native
([#&#8203;8569](DataDog/dd-trace-java#8569) -
[@&#8203;ygree](https://github.com/ygree))

#### JMX fetch

- ✨ Add support for GraalVM Native GC metrics
([#&#8203;8913](DataDog/dd-trace-java#8913) -
[@&#8203;ygree](https://github.com/ygree))

#### Library Injection

- ✨ Deny oracle db jvm based tools
([#&#8203;8909](DataDog/dd-trace-java#8909) -
[@&#8203;bric3](https://github.com/bric3))

#### OpenTracing

- 🐛 Fix OT packaging for exception replay
([#&#8203;8912](DataDog/dd-trace-java#8912) -
[@&#8203;jpbempel](https://github.com/jpbempel))

#### Profiling

- ✨ Bump ddprof to 1.27.0
([#&#8203;8893](DataDog/dd-trace-java#8893) -
[@&#8203;jbachorik](https://github.com/jbachorik))
- Properly handle the adaptive sampling interval overflow by
[@&#8203;jbachorik](https://github.com/jbachorik) in
DataDog/java-profiler#213
- Fix [#&#8203;200](DataDog/dd-trace-java#200)
Crash related to aligned\_alloc and free in context by
[@&#8203;yanglong1010](https://github.com/yanglong1010) in
DataDog/java-profiler#208
- Explicitly initialize empty context page by
[@&#8203;jbachorik](https://github.com/jbachorik) in
DataDog/java-profiler#210
- Re-connect crash recursion protection with VM stackwalker by
[@&#8203;jbachorik](https://github.com/jbachorik) in
DataDog/java-profiler#214
- ✨ Enable ZSTD compression for profiling
([#&#8203;8862](DataDog/dd-trace-java#8862) -
[@&#8203;MattAlp](https://github.com/MattAlp))
- ✨ Extend JPS re-implementation to J9 family
([#&#8203;8813](DataDog/dd-trace-java#8813) -
[@&#8203;MattAlp](https://github.com/MattAlp))
- 💡 Collect process tags for profiling upload requests
([#&#8203;8780](DataDog/dd-trace-java#8780) -
[@&#8203;amarziali](https://github.com/amarziali))

#### Telemetry

- 💡 Surface process tags on telemetry payloads
([#&#8203;8837](DataDog/dd-trace-java#8837) -
[@&#8203;amarziali](https://github.com/amarziali))

#### Trace context propagation

- ✨ Migrating all HttpClient Instrumentations to Inject Full
Context
([#&#8203;8826](DataDog/dd-trace-java#8826) -
[@&#8203;mhlidd](https://github.com/mhlidd))
- ✨ Migrating all HttpServer Instrumentations to Extract full
Context
([#&#8203;8820](DataDog/dd-trace-java#8820) -
[@&#8203;mhlidd](https://github.com/mhlidd))
- ✨ Add context API support OTel propagators
([#&#8203;8770](DataDog/dd-trace-java#8770) -
[@&#8203;PerfectSlayer](https://github.com/PerfectSlayer))

#### Tracer core

- ✨⚡ Skip JAXB generated classes classloader
([#&#8203;9003](DataDog/dd-trace-java#9003) -
[@&#8203;bric3](https://github.com/bric3))
- ✨ Add DD\_RUNTIME\_METRICS\_RUNTIME\_ID\_ENABLED alias for
runtime id generation
([#&#8203;8981](DataDog/dd-trace-java#8981) -
[@&#8203;amarziali](https://github.com/amarziali))
- 🐛 Use resolved address for peer.hostname when available without
hitting the cache
([#&#8203;8915](DataDog/dd-trace-java#8915) -
[@&#8203;amarziali](https://github.com/amarziali))
- 💡 Surface server name process tag for tomcat
([#&#8203;8894](DataDog/dd-trace-java#8894) -
[@&#8203;amarziali](https://github.com/amarziali))
- 💡 Surface websphere cell and server name on process tags
([#&#8203;8880](DataDog/dd-trace-java#8880) -
[@&#8203;amarziali](https://github.com/amarziali))
- ✨ Added special lightweight pre-main class that skips
installation on incompatible JVMs.
([#&#8203;8855](DataDog/dd-trace-java#8855) -
[@&#8203;AlexeyKuznetsov-DD](https://github.com/AlexeyKuznetsov-DD))
- 💡 Add entrypoint type to process tags
([#&#8203;8839](DataDog/dd-trace-java#8839) -
[@&#8203;amarziali](https://github.com/amarziali))
- ✨ Extend JPS re-implementation to J9 family
([#&#8203;8813](DataDog/dd-trace-java#8813) -
[@&#8203;MattAlp](https://github.com/MattAlp))
- ✨ Notify listeners when the scope top changes after switching
scope stacks
([#&#8203;8797](DataDog/dd-trace-java#8797) -
[@&#8203;mcculls](https://github.com/mcculls))
- ✨ Read hsperfdata for Java PIDs if jvmstat is unavailable
([#&#8203;8792](DataDog/dd-trace-java#8792) -
[@&#8203;MattAlp](https://github.com/MattAlp))
- 🐛 Turn JDK socket support on by default
([#&#8203;8752](DataDog/dd-trace-java#8752) -
[@&#8203;sarahchen6](https://github.com/sarahchen6))
- ✨ Simplify context propagation
([#&#8203;8719](DataDog/dd-trace-java#8719) -
[@&#8203;PerfectSlayer](https://github.com/PerfectSlayer))
- ✨ Add JSON parsing support
([#&#8203;8579](DataDog/dd-trace-java#8579) -
[@&#8203;PerfectSlayer](https://github.com/PerfectSlayer))

#### Tracer internal logging

- ✨ Fix printing format of span identifiers
([#&#8203;8897](DataDog/dd-trace-java#8897) -
[@&#8203;vandonr](https://github.com/vandonr))

#### Tracer public API

- 💡 Track the source of installation
([#&#8203;8956](DataDog/dd-trace-java#8956) -
[@&#8203;mabdinur](https://github.com/mabdinur))
- ✨ Enforce size limit on application\_monitoring.yaml files
([#&#8203;8789](DataDog/dd-trace-java#8789) -
[@&#8203;mtoffl01](https://github.com/mtoffl01))
- ✨ Enabling baggage cache to support limits and non-ascii
characters
([#&#8203;8713](DataDog/dd-trace-java#8713) -
[@&#8203;mhlidd](https://github.com/mhlidd))

### Instrumentations

#### AWS Lambda instrumentation

- ✨ Pass Lambda Request ID to Extension
([#&#8203;8814](DataDog/dd-trace-java#8814) -
[@&#8203;nhulston](https://github.com/nhulston))

#### Core Java language instrumentation

- ✨ Ensure ClassloadingInstrumentation is always applied even
with `DD_TRACE_ENABLED=false`
([#&#8203;8863](DataDog/dd-trace-java#8863) -
[@&#8203;mcculls](https://github.com/mcculls))

#### Eclipse Vert.x instrumentation

- 🐛 Do not override route with / in vertx instrumentation
([#&#8203;8881](DataDog/dd-trace-java#8881) -
[@&#8203;vandonr](https://github.com/vandonr))

#### IBM Liberty

- 🐛 Fix error mark on http status for IBM liberty
([#&#8203;8822](DataDog/dd-trace-java#8822) -
[@&#8203;amarziali](https://github.com/amarziali))

#### JDBC instrumentation

- 🐛 Do not prepend DBM <> APM trace comment in SQLCommenter if there
is a pg plan hint
([#&#8203;8864](DataDog/dd-trace-java#8864) -
[@&#8203;edengorevoy](https://github.com/edengorevoy))

#### JMS instrumentation

- ✨ Add jms as an extra integration name where there is JMS
involved
([#&#8203;8933](DataDog/dd-trace-java#8933) -
[@&#8203;vandonr](https://github.com/vandonr))

#### Kotlin instrumentation

- ✨ Enable kotlin\_coroutine integration by default
([#&#8203;8848](DataDog/dd-trace-java#8848) -
[@&#8203;mcculls](https://github.com/mcculls))
- 🧹 Rework Kotlin coroutines instrumentation around coroutine
context
([#&#8203;8774](DataDog/dd-trace-java#8774) -
[@&#8203;mcculls](https://github.com/mcculls))

#### OpenTelemetry instrumentation

- 🐛 Support WithSpan inheritContext attribute
([#&#8203;8858](DataDog/dd-trace-java#8858) -
[@&#8203;amarziali](https://github.com/amarziali))
- ✨ Add context API support OTel propagators
([#&#8203;8770](DataDog/dd-trace-java#8770) -
[@&#8203;PerfectSlayer](https://github.com/PerfectSlayer))

#### Play Framework instrumentation

- 🐛 Fix the Play Framework's span resource name priority so that the
client JAX-RS 404 cannot override it
([#&#8203;8591](DataDog/dd-trace-java#8591) -
[@&#8203;ygree](https://github.com/ygree))

#### Quarkus Instrumentation

- 🐛 Ignore quarkus jaxrs stubs and cdi wrapper proxies
([#&#8203;8891](DataDog/dd-trace-java#8891) -
[@&#8203;amarziali](https://github.com/amarziali))

#### ServiceTalk

- ✨ Improve ServiceTalk Captured Context API Instrumentation
for v0.42.56+
([#&#8203;8821](DataDog/dd-trace-java#8821) -
[@&#8203;ygree](https://github.com/ygree))

#### Spring instrumentation

- ✨ Supporting Baggage for Instrumentations used in Weblog
Tests
([#&#8203;8773](DataDog/dd-trace-java#8773) -
[@&#8203;mhlidd](https://github.com/mhlidd))

#### WebSocket Instrumentation

- 💡 Trace websocket for spring webflux reactive handlers
([#&#8203;8831](DataDog/dd-trace-java#8831) -
[@&#8203;amarziali](https://github.com/amarziali))
- 💡:test\_tube: WebSocket support for Netty
([#&#8203;8632](DataDog/dd-trace-java#8632) -
[@&#8203;ValentinZakharov](https://github.com/ValentinZakharov))

#### Zio Instrumentation

- 🧹 Cleanup Zio fiber instrumentation to avoid repeated activation
of continuation
([#&#8203;8798](DataDog/dd-trace-java#8798) -
[@&#8203;mcculls](https://github.com/mcculls))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 6pm every weekday,before 2am
every weekday" in timezone Australia/Melbourne, Automerge - At any time
(no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Never, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Renovate
Bot](https://github.com/renovatebot/renovate).

GitOrigin-RevId: 9207366cdb6a1bd098082305d354a0a3c4622d7a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants