Skip to content

Improve VirtualThread context tracking instrumentation#11009

Merged
gh-worker-dd-mergequeue-cf854d[bot] merged 4 commits intomasterfrom
bbujon/virtual-threads
Apr 7, 2026
Merged

Improve VirtualThread context tracking instrumentation#11009
gh-worker-dd-mergequeue-cf854d[bot] merged 4 commits intomasterfrom
bbujon/virtual-threads

Conversation

@PerfectSlayer
Copy link
Copy Markdown
Contributor

@PerfectSlayer PerfectSlayer commented Mar 31, 2026

What Does This Do

This PR addresses the following issues with VirtualThread instrumentation:

Motivation

I did not check at bytecode level the changes from the original PRs and that was wrong. That introduces regression and keep pushing in the wrong direction. This is a basically a redo of the instrumentation using context swap and continuation.

Additional Notes

This PR also mirrors the context testing capability from the JUnit instrumentation tests.

Contributor Checklist

Jira ticket: [PROJ-IDENT]

Note: Once your PR is ready to merge, add it to the merge queue by commenting /merge. /merge -c cancels the queue request. /merge -f --reason "reason" skips all merge queue checks; please use this judiciously, as some checks do not run at the PR-level. For more information, see this doc.

@PerfectSlayer PerfectSlayer added type: bug Bug report and fix comp: context propagation Trace context propagation inst: java Core Java language instrumentation labels Mar 31, 2026
@PerfectSlayer PerfectSlayer changed the title Prevent duplicate instrumentation conflict between VirtualThread and Runnable Improve VirtualThread instrumentation Apr 2, 2026
Replaces the `ConcurrentState` approach (which activated/closed individual scopes) with `VirtualThreadState` that swaps the entire scope stack via `Context#swap()`. This correctly handles child spans created during virtual thread execution and avoids out-of-order scope closing. The new approach mirrors the ZIO FiberContext and Kotlin coroutines instrumentation patterns.
@PerfectSlayer PerfectSlayer force-pushed the bbujon/virtual-threads branch from ea327b5 to d0e39d9 Compare April 3, 2026 14:58
Replaces the `ConcurrentState` approach (which activated/closed individual scopes) with `VirtualThreadState` that swaps the entire scope stack via `Context#swap()`. This correctly handles child spans created during virtual thread execution and avoids out-of-order scope closing. The new approach mirrors the ZIO FiberContext and Kotlin coroutines instrumentation patterns.
@PerfectSlayer PerfectSlayer force-pushed the bbujon/virtual-threads branch from 2788193 to 45d06be Compare April 3, 2026 15:37
@pr-commenter
Copy link
Copy Markdown

pr-commenter bot commented Apr 3, 2026

Benchmarks

Startup

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master bbujon/virtual-threads
git_commit_date 1775213366 1775230600
git_commit_sha e16815c 45d06be
release_version 1.61.0-SNAPSHOT~e16815c31c 1.61.0-SNAPSHOT~45d06beb1c
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1775232315 1775232315
ci_job_id 1566544754 1566544754
ci_pipeline_id 105952286 105952286
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-b7t2mbws 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-b7t2mbws 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 1 performance improvements and 0 performance regressions! Performance is the same for 59 metrics, 11 unstable metrics.

scenario Δ mean execution_time candidate mean execution_time baseline mean execution_time
scenario:startup:insecure-bank:tracing:crashtracking better
[-104.433µs; -32.589µs] or [-8.373%; -2.613%]
1.179ms 1.247ms
Startup time reports for petclinic
gantt
    title petclinic - global startup overhead: candidate=1.61.0-SNAPSHOT~45d06beb1c, baseline=1.61.0-SNAPSHOT~e16815c31c

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.058 s) : 0, 1057952
Total [baseline] (11.153 s) : 0, 11152550
Agent [candidate] (1.065 s) : 0, 1065247
Total [candidate] (11.066 s) : 0, 11066194
section appsec
Agent [baseline] (1.257 s) : 0, 1256514
Total [baseline] (11.155 s) : 0, 11154973
Agent [candidate] (1.251 s) : 0, 1251422
Total [candidate] (11.161 s) : 0, 11161465
section iast
Agent [baseline] (1.235 s) : 0, 1234778
Total [baseline] (11.353 s) : 0, 11352614
Agent [candidate] (1.222 s) : 0, 1221943
Total [candidate] (11.403 s) : 0, 11403105
section profiling
Agent [baseline] (1.192 s) : 0, 1191753
Total [baseline] (11.061 s) : 0, 11060796
Agent [candidate] (1.191 s) : 0, 1191419
Total [candidate] (11.251 s) : 0, 11250924
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.058 s -
Agent appsec 1.257 s 198.562 ms (18.8%)
Agent iast 1.235 s 176.826 ms (16.7%)
Agent profiling 1.192 s 133.801 ms (12.6%)
Total tracing 11.153 s -
Total appsec 11.155 s 2.422 ms (0.0%)
Total iast 11.353 s 200.064 ms (1.8%)
Total profiling 11.061 s -91.755 ms (-0.8%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.065 s -
Agent appsec 1.251 s 186.175 ms (17.5%)
Agent iast 1.222 s 156.696 ms (14.7%)
Agent profiling 1.191 s 126.172 ms (11.8%)
Total tracing 11.066 s -
Total appsec 11.161 s 95.271 ms (0.9%)
Total iast 11.403 s 336.911 ms (3.0%)
Total profiling 11.251 s 184.73 ms (1.7%)
gantt
    title petclinic - break down per module: candidate=1.61.0-SNAPSHOT~45d06beb1c, baseline=1.61.0-SNAPSHOT~e16815c31c

    dateFormat X
    axisFormat %s
section tracing
crashtracking [baseline] (1.201 ms) : 0, 1201
crashtracking [candidate] (1.236 ms) : 0, 1236
BytebuddyAgent [baseline] (634.036 ms) : 0, 634036
BytebuddyAgent [candidate] (637.372 ms) : 0, 637372
AgentMeter [baseline] (29.55 ms) : 0, 29550
AgentMeter [candidate] (29.643 ms) : 0, 29643
GlobalTracer [baseline] (249.299 ms) : 0, 249299
GlobalTracer [candidate] (250.895 ms) : 0, 250895
AppSec [baseline] (32.179 ms) : 0, 32179
AppSec [candidate] (32.319 ms) : 0, 32319
Debugger [baseline] (60.179 ms) : 0, 60179
Debugger [candidate] (60.645 ms) : 0, 60645
Remote Config [baseline] (628.654 µs) : 0, 629
Remote Config [candidate] (596.195 µs) : 0, 596
Telemetry [baseline] (8.117 ms) : 0, 8117
Telemetry [candidate] (8.165 ms) : 0, 8165
Flare Poller [baseline] (6.636 ms) : 0, 6636
Flare Poller [candidate] (8.217 ms) : 0, 8217
section appsec
crashtracking [baseline] (1.212 ms) : 0, 1212
crashtracking [candidate] (1.208 ms) : 0, 1208
BytebuddyAgent [baseline] (668.746 ms) : 0, 668746
BytebuddyAgent [candidate] (666.145 ms) : 0, 666145
AgentMeter [baseline] (12.22 ms) : 0, 12220
AgentMeter [candidate] (12.16 ms) : 0, 12160
GlobalTracer [baseline] (249.627 ms) : 0, 249627
GlobalTracer [candidate] (248.423 ms) : 0, 248423
IAST [baseline] (24.575 ms) : 0, 24575
IAST [candidate] (24.481 ms) : 0, 24481
AppSec [baseline] (184.131 ms) : 0, 184131
AppSec [candidate] (183.646 ms) : 0, 183646
Debugger [baseline] (66.272 ms) : 0, 66272
Debugger [candidate] (66.299 ms) : 0, 66299
Remote Config [baseline] (612.072 µs) : 0, 612
Remote Config [candidate] (603.135 µs) : 0, 603
Telemetry [baseline] (8.807 ms) : 0, 8807
Telemetry [candidate] (8.553 ms) : 0, 8553
Flare Poller [baseline] (3.631 ms) : 0, 3631
Flare Poller [candidate] (3.528 ms) : 0, 3528
section iast
crashtracking [baseline] (1.195 ms) : 0, 1195
crashtracking [candidate] (1.182 ms) : 0, 1182
BytebuddyAgent [baseline] (807.734 ms) : 0, 807734
BytebuddyAgent [candidate] (799.332 ms) : 0, 799332
AgentMeter [baseline] (11.454 ms) : 0, 11454
AgentMeter [candidate] (11.369 ms) : 0, 11369
GlobalTracer [baseline] (241.238 ms) : 0, 241238
GlobalTracer [candidate] (238.334 ms) : 0, 238334
IAST [baseline] (26.225 ms) : 0, 26225
IAST [candidate] (25.884 ms) : 0, 25884
AppSec [baseline] (32.02 ms) : 0, 32020
AppSec [candidate] (30.372 ms) : 0, 30372
Debugger [baseline] (59.128 ms) : 0, 59128
Debugger [candidate] (61.806 ms) : 0, 61806
Remote Config [baseline] (530.134 µs) : 0, 530
Remote Config [candidate] (523.528 µs) : 0, 524
Telemetry [baseline] (14.466 ms) : 0, 14466
Telemetry [candidate] (12.636 ms) : 0, 12636
Flare Poller [baseline] (4.165 ms) : 0, 4165
Flare Poller [candidate] (4.183 ms) : 0, 4183
section profiling
crashtracking [baseline] (1.197 ms) : 0, 1197
crashtracking [candidate] (1.177 ms) : 0, 1177
BytebuddyAgent [baseline] (696.292 ms) : 0, 696292
BytebuddyAgent [candidate] (694.587 ms) : 0, 694587
AgentMeter [baseline] (9.215 ms) : 0, 9215
AgentMeter [candidate] (9.114 ms) : 0, 9114
GlobalTracer [baseline] (208.735 ms) : 0, 208735
GlobalTracer [candidate] (207.875 ms) : 0, 207875
AppSec [baseline] (32.9 ms) : 0, 32900
AppSec [candidate] (32.955 ms) : 0, 32955
Debugger [baseline] (65.855 ms) : 0, 65855
Debugger [candidate] (66.416 ms) : 0, 66416
Remote Config [baseline] (566.44 µs) : 0, 566
Remote Config [candidate] (576.655 µs) : 0, 577
Telemetry [baseline] (7.85 ms) : 0, 7850
Telemetry [candidate] (7.969 ms) : 0, 7969
Flare Poller [baseline] (3.597 ms) : 0, 3597
Flare Poller [candidate] (3.674 ms) : 0, 3674
ProfilingAgent [baseline] (93.636 ms) : 0, 93636
ProfilingAgent [candidate] (95.727 ms) : 0, 95727
Profiling [baseline] (94.201 ms) : 0, 94201
Profiling [candidate] (96.298 ms) : 0, 96298
Loading
Startup time reports for insecure-bank
gantt
    title insecure-bank - global startup overhead: candidate=1.61.0-SNAPSHOT~45d06beb1c, baseline=1.61.0-SNAPSHOT~e16815c31c

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.082 s) : 0, 1081896
Total [baseline] (8.987 s) : 0, 8986664
Agent [candidate] (1.05 s) : 0, 1049928
Total [candidate] (8.852 s) : 0, 8851585
section iast
Agent [baseline] (1.231 s) : 0, 1230866
Total [baseline] (9.624 s) : 0, 9623521
Agent [candidate] (1.232 s) : 0, 1232385
Total [candidate] (9.574 s) : 0, 9573566
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.082 s -
Agent iast 1.231 s 148.97 ms (13.8%)
Total tracing 8.987 s -
Total iast 9.624 s 636.856 ms (7.1%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.05 s -
Agent iast 1.232 s 182.457 ms (17.4%)
Total tracing 8.852 s -
Total iast 9.574 s 721.981 ms (8.2%)
gantt
    title insecure-bank - break down per module: candidate=1.61.0-SNAPSHOT~45d06beb1c, baseline=1.61.0-SNAPSHOT~e16815c31c

    dateFormat X
    axisFormat %s
section tracing
crashtracking [baseline] (1.247 ms) : 0, 1247
crashtracking [candidate] (1.179 ms) : 0, 1179
BytebuddyAgent [baseline] (649.781 ms) : 0, 649781
BytebuddyAgent [candidate] (630.7 ms) : 0, 630700
AgentMeter [baseline] (30.342 ms) : 0, 30342
AgentMeter [candidate] (29.242 ms) : 0, 29242
GlobalTracer [baseline] (254.782 ms) : 0, 254782
GlobalTracer [candidate] (248.192 ms) : 0, 248192
AppSec [baseline] (33.113 ms) : 0, 33113
AppSec [candidate] (31.887 ms) : 0, 31887
Debugger [baseline] (61.111 ms) : 0, 61111
Debugger [candidate] (59.142 ms) : 0, 59142
Remote Config [baseline] (614.076 µs) : 0, 614
Remote Config [candidate] (590.792 µs) : 0, 591
Telemetry [baseline] (8.376 ms) : 0, 8376
Telemetry [candidate] (7.988 ms) : 0, 7988
Flare Poller [baseline] (5.993 ms) : 0, 5993
Flare Poller [candidate] (5.073 ms) : 0, 5073
section iast
crashtracking [baseline] (1.202 ms) : 0, 1202
crashtracking [candidate] (1.191 ms) : 0, 1191
BytebuddyAgent [baseline] (805.728 ms) : 0, 805728
BytebuddyAgent [candidate] (805.318 ms) : 0, 805318
AgentMeter [baseline] (11.396 ms) : 0, 11396
AgentMeter [candidate] (11.578 ms) : 0, 11578
GlobalTracer [baseline] (240.742 ms) : 0, 240742
GlobalTracer [candidate] (241.292 ms) : 0, 241292
IAST [baseline] (26.126 ms) : 0, 26126
IAST [candidate] (26.301 ms) : 0, 26301
AppSec [baseline] (32.063 ms) : 0, 32063
AppSec [candidate] (29.967 ms) : 0, 29967
Debugger [baseline] (57.898 ms) : 0, 57898
Debugger [candidate] (61.633 ms) : 0, 61633
Remote Config [baseline] (528.712 µs) : 0, 529
Remote Config [candidate] (534.735 µs) : 0, 535
Telemetry [baseline] (14.77 ms) : 0, 14770
Telemetry [candidate] (13.634 ms) : 0, 13634
Flare Poller [baseline] (3.947 ms) : 0, 3947
Flare Poller [candidate] (4.761 ms) : 0, 4761
Loading

Load

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master bbujon/virtual-threads
git_commit_date 1775213366 1775230600
git_commit_sha e16815c 45d06be
release_version 1.61.0-SNAPSHOT~e16815c31c 1.61.0-SNAPSHOT~45d06beb1c
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1775232881 1775232881
ci_job_id 1566544758 1566544758
ci_pipeline_id 105952286 105952286
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-0hqs14u6 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-0hqs14u6 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 3 performance improvements and 0 performance regressions! Performance is the same for 15 metrics, 18 unstable metrics.

scenario Δ mean agg_http_req_duration_p50 Δ mean agg_http_req_duration_p95 Δ mean throughput candidate mean agg_http_req_duration_p50 candidate mean agg_http_req_duration_p95 candidate mean throughput baseline mean agg_http_req_duration_p50 baseline mean agg_http_req_duration_p95 baseline mean throughput
scenario:load:petclinic:iast:high_load better
[-2.279ms; -0.654ms] or [-11.961%; -3.435%]
better
[-3.302ms; -0.696ms] or [-10.775%; -2.272%]
unstable
[-12.884op/s; +43.196op/s] or [-5.308%; +17.797%]
17.586ms 28.645ms 257.875op/s 19.052ms 30.644ms 242.719op/s
scenario:load:petclinic:tracing:high_load better
[-1151.183µs; -423.828µs] or [-6.283%; -2.313%]
unsure
[-1767.501µs; -74.475µs] or [-5.942%; -0.250%]
unstable
[-19.734op/s; +35.172op/s] or [-7.859%; +14.007%]
17.533ms 28.823ms 258.812op/s 18.321ms 29.744ms 251.094op/s
Request duration reports for insecure-bank
gantt
    title insecure-bank - request duration [CI 0.99] : candidate=1.61.0-SNAPSHOT~45d06beb1c, baseline=1.61.0-SNAPSHOT~e16815c31c
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.242 ms) : 1230, 1255
.   : milestone, 1242,
iast (3.336 ms) : 3288, 3384
.   : milestone, 3336,
iast_FULL (6.018 ms) : 5959, 6078
.   : milestone, 6018,
iast_GLOBAL (3.78 ms) : 3715, 3845
.   : milestone, 3780,
profiling (2.335 ms) : 2312, 2358
.   : milestone, 2335,
tracing (1.896 ms) : 1880, 1912
.   : milestone, 1896,
section candidate
no_agent (1.244 ms) : 1232, 1256
.   : milestone, 1244,
iast (3.265 ms) : 3219, 3311
.   : milestone, 3265,
iast_FULL (5.984 ms) : 5923, 6045
.   : milestone, 5984,
iast_GLOBAL (3.682 ms) : 3618, 3747
.   : milestone, 3682,
profiling (2.281 ms) : 2259, 2304
.   : milestone, 2281,
tracing (1.86 ms) : 1844, 1875
.   : milestone, 1860,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 1.242 ms [1.23 ms, 1.255 ms] -
iast 3.336 ms [3.288 ms, 3.384 ms] 2.093 ms (168.5%)
iast_FULL 6.018 ms [5.959 ms, 6.078 ms] 4.776 ms (384.4%)
iast_GLOBAL 3.78 ms [3.715 ms, 3.845 ms] 2.538 ms (204.3%)
profiling 2.335 ms [2.312 ms, 2.358 ms] 1.092 ms (87.9%)
tracing 1.896 ms [1.88 ms, 1.912 ms] 653.617 µs (52.6%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 1.244 ms [1.232 ms, 1.256 ms] -
iast 3.265 ms [3.219 ms, 3.311 ms] 2.021 ms (162.5%)
iast_FULL 5.984 ms [5.923 ms, 6.045 ms] 4.74 ms (381.1%)
iast_GLOBAL 3.682 ms [3.618 ms, 3.747 ms] 2.439 ms (196.1%)
profiling 2.281 ms [2.259 ms, 2.304 ms] 1.037 ms (83.4%)
tracing 1.86 ms [1.844 ms, 1.875 ms] 615.902 µs (49.5%)
Request duration reports for petclinic
gantt
    title petclinic - request duration [CI 0.99] : candidate=1.61.0-SNAPSHOT~45d06beb1c, baseline=1.61.0-SNAPSHOT~e16815c31c
    dateFormat X
    axisFormat %s
section baseline
no_agent (18.604 ms) : 18412, 18795
.   : milestone, 18604,
appsec (18.864 ms) : 18676, 19052
.   : milestone, 18864,
code_origins (18.066 ms) : 17884, 18248
.   : milestone, 18066,
iast (19.229 ms) : 19030, 19428
.   : milestone, 19229,
profiling (18.747 ms) : 18559, 18934
.   : milestone, 18747,
tracing (18.581 ms) : 18394, 18769
.   : milestone, 18581,
section candidate
no_agent (19.163 ms) : 18968, 19358
.   : milestone, 19163,
appsec (18.798 ms) : 18607, 18988
.   : milestone, 18798,
code_origins (17.962 ms) : 17785, 18138
.   : milestone, 17962,
iast (18.092 ms) : 17910, 18275
.   : milestone, 18092,
profiling (18.854 ms) : 18661, 19047
.   : milestone, 18854,
tracing (18.026 ms) : 17846, 18206
.   : milestone, 18026,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 18.604 ms [18.412 ms, 18.795 ms] -
appsec 18.864 ms [18.676 ms, 19.052 ms] 260.289 µs (1.4%)
code_origins 18.066 ms [17.884 ms, 18.248 ms] -537.541 µs (-2.9%)
iast 19.229 ms [19.03 ms, 19.428 ms] 625.546 µs (3.4%)
profiling 18.747 ms [18.559 ms, 18.934 ms] 142.881 µs (0.8%)
tracing 18.581 ms [18.394 ms, 18.769 ms] -22.424 µs (-0.1%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 19.163 ms [18.968 ms, 19.358 ms] -
appsec 18.798 ms [18.607 ms, 18.988 ms] -365.509 µs (-1.9%)
code_origins 17.962 ms [17.785 ms, 18.138 ms] -1.202 ms (-6.3%)
iast 18.092 ms [17.91 ms, 18.275 ms] -1.071 ms (-5.6%)
profiling 18.854 ms [18.661 ms, 19.047 ms] -309.259 µs (-1.6%)
tracing 18.026 ms [17.846 ms, 18.206 ms] -1.137 ms (-5.9%)

Dacapo

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master bbujon/virtual-threads
git_commit_date 1775213366 1775230600
git_commit_sha e16815c 45d06be
release_version 1.61.0-SNAPSHOT~e16815c31c 1.61.0-SNAPSHOT~45d06beb1c
See matching parameters
Baseline Candidate
application biojava biojava
ci_job_date 1775232596 1775232596
ci_job_id 1566544760 1566544760
ci_pipeline_id 105952286 105952286
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-3-rp2byx5z 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-3-rp2byx5z 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

Summary

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

Execution time for tomcat
gantt
    title tomcat - execution time [CI 0.99] : candidate=1.61.0-SNAPSHOT~45d06beb1c, baseline=1.61.0-SNAPSHOT~e16815c31c
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.483 ms) : 1471, 1494
.   : milestone, 1483,
appsec (3.82 ms) : 3598, 4043
.   : milestone, 3820,
iast (2.273 ms) : 2204, 2342
.   : milestone, 2273,
iast_GLOBAL (2.312 ms) : 2242, 2381
.   : milestone, 2312,
profiling (2.111 ms) : 2055, 2167
.   : milestone, 2111,
tracing (2.079 ms) : 2025, 2133
.   : milestone, 2079,
section candidate
no_agent (1.486 ms) : 1474, 1497
.   : milestone, 1486,
appsec (3.834 ms) : 3613, 4056
.   : milestone, 3834,
iast (2.268 ms) : 2199, 2338
.   : milestone, 2268,
iast_GLOBAL (2.317 ms) : 2247, 2387
.   : milestone, 2317,
profiling (2.095 ms) : 2040, 2150
.   : milestone, 2095,
tracing (2.077 ms) : 2023, 2130
.   : milestone, 2077,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.483 ms [1.471 ms, 1.494 ms] -
appsec 3.82 ms [3.598 ms, 4.043 ms] 2.337 ms (157.6%)
iast 2.273 ms [2.204 ms, 2.342 ms] 790.161 µs (53.3%)
iast_GLOBAL 2.312 ms [2.242 ms, 2.381 ms] 828.654 µs (55.9%)
profiling 2.111 ms [2.055 ms, 2.167 ms] 628.146 µs (42.4%)
tracing 2.079 ms [2.025 ms, 2.133 ms] 596.021 µs (40.2%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.486 ms [1.474 ms, 1.497 ms] -
appsec 3.834 ms [3.613 ms, 4.056 ms] 2.348 ms (158.1%)
iast 2.268 ms [2.199 ms, 2.338 ms] 782.681 µs (52.7%)
iast_GLOBAL 2.317 ms [2.247 ms, 2.387 ms] 831.395 µs (56.0%)
profiling 2.095 ms [2.04 ms, 2.15 ms] 609.052 µs (41.0%)
tracing 2.077 ms [2.023 ms, 2.13 ms] 590.812 µs (39.8%)
Execution time for biojava
gantt
    title biojava - execution time [CI 0.99] : candidate=1.61.0-SNAPSHOT~45d06beb1c, baseline=1.61.0-SNAPSHOT~e16815c31c
    dateFormat X
    axisFormat %s
section baseline
no_agent (15.157 s) : 15157000, 15157000
.   : milestone, 15157000,
appsec (14.803 s) : 14803000, 14803000
.   : milestone, 14803000,
iast (19.462 s) : 19462000, 19462000
.   : milestone, 19462000,
iast_GLOBAL (17.766 s) : 17766000, 17766000
.   : milestone, 17766000,
profiling (14.918 s) : 14918000, 14918000
.   : milestone, 14918000,
tracing (14.743 s) : 14743000, 14743000
.   : milestone, 14743000,
section candidate
no_agent (15.555 s) : 15555000, 15555000
.   : milestone, 15555000,
appsec (14.851 s) : 14851000, 14851000
.   : milestone, 14851000,
iast (18.334 s) : 18334000, 18334000
.   : milestone, 18334000,
iast_GLOBAL (17.435 s) : 17435000, 17435000
.   : milestone, 17435000,
profiling (14.884 s) : 14884000, 14884000
.   : milestone, 14884000,
tracing (14.738 s) : 14738000, 14738000
.   : milestone, 14738000,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 15.157 s [15.157 s, 15.157 s] -
appsec 14.803 s [14.803 s, 14.803 s] -354.0 ms (-2.3%)
iast 19.462 s [19.462 s, 19.462 s] 4.305 s (28.4%)
iast_GLOBAL 17.766 s [17.766 s, 17.766 s] 2.609 s (17.2%)
profiling 14.918 s [14.918 s, 14.918 s] -239.0 ms (-1.6%)
tracing 14.743 s [14.743 s, 14.743 s] -414.0 ms (-2.7%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 15.555 s [15.555 s, 15.555 s] -
appsec 14.851 s [14.851 s, 14.851 s] -704.0 ms (-4.5%)
iast 18.334 s [18.334 s, 18.334 s] 2.779 s (17.9%)
iast_GLOBAL 17.435 s [17.435 s, 17.435 s] 1.88 s (12.1%)
profiling 14.884 s [14.884 s, 14.884 s] -671.0 ms (-4.3%)
tracing 14.738 s [14.738 s, 14.738 s] -817.0 ms (-5.3%)

@PerfectSlayer PerfectSlayer marked this pull request as ready for review April 3, 2026 17:11
@PerfectSlayer PerfectSlayer requested review from a team as code owners April 3, 2026 17:11
@PerfectSlayer PerfectSlayer requested review from dougqh and mcculls and removed request for a team April 3, 2026 17:11

/** Called on mount: swaps the virtual thread's context into the carrier thread. */
public void onMount() {
this.previousContext = this.context.swap();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice, that's the kind of API that I was imagining

Copy link
Copy Markdown
Contributor

@mcculls mcculls left a comment

Choose a reason for hiding this comment

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

LGTM!

@PerfectSlayer
Copy link
Copy Markdown
Contributor Author

/merge

@gh-worker-devflow-routing-ef8351
Copy link
Copy Markdown

gh-worker-devflow-routing-ef8351 bot commented Apr 7, 2026

View all feedbacks in Devflow UI.

2026-04-07 08:31:13 UTC ℹ️ Start processing command /merge


2026-04-07 08:31:18 UTC ℹ️ MergeQueue: pull request added to the queue

The expected merge time in master is approximately 2h (p90).


2026-04-07 09:34:00 UTC ℹ️ MergeQueue: This merge request was merged

@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d bot merged commit a1f4ec5 into master Apr 7, 2026
569 checks passed
@gh-worker-dd-mergequeue-cf854d gh-worker-dd-mergequeue-cf854d bot deleted the bbujon/virtual-threads branch April 7, 2026 09:33
@github-actions github-actions bot added this to the 1.61.0 milestone Apr 7, 2026
@PerfectSlayer PerfectSlayer changed the title Improve VirtualThread instrumentation Improve VirtualThread context tracking instrumentation Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: context propagation Trace context propagation inst: java Core Java language instrumentation type: bug Bug report and fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants