Skip to content

Conversation

@mcculls
Copy link
Contributor

@mcculls mcculls commented Nov 17, 2025

What Does This Do

Counterpart to #9982 - while #9982 supports manipulation of existing W3C baggage using the OpenTelemetry API, this PR supports propagation of purely OpenTelemetry created baggage via outgoing W3C headers.

The approach taken here was to automatically transfer OpenTelemetry baggage on activation into our internal baggage container, because that's what ends up getting checked by the W3C propagator. Our baggage container remains visible via the OpenTelemetry API thanks to #9982

The alternative approach would have been to instrument all origins of OpenTelemetry baggage to instead return our wrappers. This would have involved instrumenting both Baggage.empty() and BaggageBuilder.build().

Motivation

Some users want to create W3C baggage using custom instrumentation.

Additional Notes

Custom BaggageEntryMetadata is not yet used in OpenTelemetry (src) so it is not supported as part of this PR.

Contributor Checklist

Jira ticket: APMAPI-1754

@mcculls mcculls requested review from a team as code owners November 17, 2025 19:06
@mcculls mcculls requested review from mhlidd and removed request for a team November 17, 2025 19:06
@mcculls mcculls added type: feature request inst: opentelemetry OpenTelemetry instrumentation labels Nov 17, 2025
@datadog-official

This comment has been minimized.

.put("FOO","OTEL_UNTOUCHED")
.put("remove_me_key", "otel_remove_me_value")
.build()
.makeCurrent()
Copy link
Contributor

Choose a reason for hiding this comment

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

❓ (For my own understanding). I assume that this makeCurrent() invokes our OTelContext instead of the OpenTelemetry Context implementation. How does the makeCurrent() know to use our implementation? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note this is Baggage.makeCurrent() :)

Baggage inherits this default method from ImplicitContextKeyed: https://github.com/open-telemetry/opentelemetry-java/blob/main/context/src/main/java/io/opentelemetry/context/ImplicitContextKeyed.java#L33

  default Scope makeCurrent() {
    return Context.current().with(this).makeCurrent();
  }

Notice how it's implemented by getting the current Context (which will be our OtelContext wrapper) to which it adds the new baggage via with (which we'll intercept via our OtelContext wrapper) before activating the resulting context.

Copy link
Contributor

Choose a reason for hiding this comment

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

Most of this makes sense. The part that I'm confused about is how our OtelContext wrapper gets magically used here instead of the OTel implementation of Context, since I don't see anywhere where we explicitly "set" OtelContext as the global implementation for io.opentelemetry.context.Context.

Hope the question makes sense!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Ahh that makes sense. We instrument the calls made to OTel Context and specify to use our OtelContext instead. Thanks for the explanation! :)

@pr-commenter
Copy link

pr-commenter bot commented Nov 17, 2025

Benchmarks

Startup

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master mcculls/w3c-otel-baggage-interop-pt2
git_commit_date 1763457398 1763461219
git_commit_sha 6721645 9fa02e6
release_version 1.56.0-SNAPSHOT~6721645b9b 1.56.0-SNAPSHOT~9fa02e6d8a
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1763463078 1763463078
ci_job_id 1241381096 1241381096
ci_pipeline_id 82880419 82880419
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-zfyrx7zua-project-304-concurrent-0-3o5czkk5 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-zfyrx7zua-project-304-concurrent-0-3o5czkk5 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 58 metrics, 7 unstable metrics.

Startup time reports for insecure-bank
gantt
    title insecure-bank - global startup overhead: candidate=1.56.0-SNAPSHOT~9fa02e6d8a, baseline=1.56.0-SNAPSHOT~6721645b9b

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.098 s) : 0, 1097560
Total [baseline] (8.864 s) : 0, 8864124
Agent [candidate] (1.1 s) : 0, 1100003
Total [candidate] (8.839 s) : 0, 8838687
section iast
Agent [baseline] (1.239 s) : 0, 1239459
Total [baseline] (9.62 s) : 0, 9619958
Agent [candidate] (1.238 s) : 0, 1238411
Total [candidate] (9.538 s) : 0, 9537972
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.098 s -
Agent iast 1.239 s 141.899 ms (12.9%)
Total tracing 8.864 s -
Total iast 9.62 s 755.834 ms (8.5%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.1 s -
Agent iast 1.238 s 138.408 ms (12.6%)
Total tracing 8.839 s -
Total iast 9.538 s 699.285 ms (7.9%)
gantt
    title insecure-bank - break down per module: candidate=1.56.0-SNAPSHOT~9fa02e6d8a, baseline=1.56.0-SNAPSHOT~6721645b9b

    dateFormat X
    axisFormat %s
section tracing
crashtracking [baseline] (1.468 ms) : 0, 1468
crashtracking [candidate] (1.474 ms) : 0, 1474
BytebuddyAgent [baseline] (704.877 ms) : 0, 704877
BytebuddyAgent [candidate] (706.192 ms) : 0, 706192
GlobalTracer [baseline] (248.449 ms) : 0, 248449
GlobalTracer [candidate] (249.111 ms) : 0, 249111
AppSec [baseline] (32.227 ms) : 0, 32227
AppSec [candidate] (32.31 ms) : 0, 32310
Debugger [baseline] (63.301 ms) : 0, 63301
Debugger [candidate] (63.566 ms) : 0, 63566
Remote Config [baseline] (628.548 µs) : 0, 629
Remote Config [candidate] (628.011 µs) : 0, 628
Telemetry [baseline] (8.053 ms) : 0, 8053
Telemetry [candidate] (8.073 ms) : 0, 8073
Flare Poller [baseline] (3.636 ms) : 0, 3636
Flare Poller [candidate] (3.686 ms) : 0, 3686
section iast
crashtracking [baseline] (1.468 ms) : 0, 1468
crashtracking [candidate] (1.471 ms) : 0, 1471
BytebuddyAgent [baseline] (829.7 ms) : 0, 829700
BytebuddyAgent [candidate] (831.145 ms) : 0, 831145
GlobalTracer [baseline] (238.468 ms) : 0, 238468
GlobalTracer [candidate] (237.724 ms) : 0, 237724
AppSec [baseline] (33.404 ms) : 0, 33404
AppSec [candidate] (33.373 ms) : 0, 33373
Debugger [baseline] (61.057 ms) : 0, 61057
Debugger [candidate] (59.8 ms) : 0, 59800
Remote Config [baseline] (562.361 µs) : 0, 562
Remote Config [candidate] (540.33 µs) : 0, 540
Telemetry [baseline] (7.734 ms) : 0, 7734
Telemetry [candidate] (7.561 ms) : 0, 7561
Flare Poller [baseline] (3.509 ms) : 0, 3509
Flare Poller [candidate] (3.465 ms) : 0, 3465
IAST [baseline] (28.521 ms) : 0, 28521
IAST [candidate] (28.26 ms) : 0, 28260
Loading
Startup time reports for petclinic
gantt
    title petclinic - global startup overhead: candidate=1.56.0-SNAPSHOT~9fa02e6d8a, baseline=1.56.0-SNAPSHOT~6721645b9b

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.106 s) : 0, 1105849
Total [baseline] (10.863 s) : 0, 10863123
Agent [candidate] (1.101 s) : 0, 1101360
Total [candidate] (10.711 s) : 0, 10710849
section appsec
Agent [baseline] (1.281 s) : 0, 1280563
Total [baseline] (11.007 s) : 0, 11006529
Agent [candidate] (1.287 s) : 0, 1286779
Total [candidate] (11.071 s) : 0, 11070598
section iast
Agent [baseline] (1.235 s) : 0, 1235499
Total [baseline] (11.217 s) : 0, 11217252
Agent [candidate] (1.244 s) : 0, 1243901
Total [candidate] (11.253 s) : 0, 11253003
section profiling
Agent [baseline] (1.233 s) : 0, 1233145
Total [baseline] (11.066 s) : 0, 11065844
Agent [candidate] (1.243 s) : 0, 1243255
Total [candidate] (11.135 s) : 0, 11134592
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.106 s -
Agent appsec 1.281 s 174.713 ms (15.8%)
Agent iast 1.235 s 129.65 ms (11.7%)
Agent profiling 1.233 s 127.296 ms (11.5%)
Total tracing 10.863 s -
Total appsec 11.007 s 143.406 ms (1.3%)
Total iast 11.217 s 354.129 ms (3.3%)
Total profiling 11.066 s 202.721 ms (1.9%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.101 s -
Agent appsec 1.287 s 185.419 ms (16.8%)
Agent iast 1.244 s 142.541 ms (12.9%)
Agent profiling 1.243 s 141.895 ms (12.9%)
Total tracing 10.711 s -
Total appsec 11.071 s 359.749 ms (3.4%)
Total iast 11.253 s 542.154 ms (5.1%)
Total profiling 11.135 s 423.742 ms (4.0%)
gantt
    title petclinic - break down per module: candidate=1.56.0-SNAPSHOT~9fa02e6d8a, baseline=1.56.0-SNAPSHOT~6721645b9b

    dateFormat X
    axisFormat %s
section tracing
crashtracking [baseline] (1.475 ms) : 0, 1475
crashtracking [candidate] (1.463 ms) : 0, 1463
BytebuddyAgent [baseline] (709.604 ms) : 0, 709604
BytebuddyAgent [candidate] (706.191 ms) : 0, 706191
GlobalTracer [baseline] (250.002 ms) : 0, 250002
GlobalTracer [candidate] (249.336 ms) : 0, 249336
AppSec [baseline] (32.576 ms) : 0, 32576
AppSec [candidate] (32.468 ms) : 0, 32468
Debugger [baseline] (64.625 ms) : 0, 64625
Debugger [candidate] (64.366 ms) : 0, 64366
Remote Config [baseline] (637.91 µs) : 0, 638
Remote Config [candidate] (640.23 µs) : 0, 640
Telemetry [baseline] (8.141 ms) : 0, 8141
Telemetry [candidate] (8.209 ms) : 0, 8209
Flare Poller [baseline] (3.685 ms) : 0, 3685
Flare Poller [candidate] (3.705 ms) : 0, 3705
section appsec
crashtracking [baseline] (1.461 ms) : 0, 1461
crashtracking [candidate] (1.474 ms) : 0, 1474
BytebuddyAgent [baseline] (729.399 ms) : 0, 729399
BytebuddyAgent [candidate] (734.803 ms) : 0, 734803
GlobalTracer [baseline] (240.792 ms) : 0, 240792
GlobalTracer [candidate] (241.66 ms) : 0, 241660
AppSec [baseline] (174.672 ms) : 0, 174672
AppSec [candidate] (174.971 ms) : 0, 174971
Debugger [baseline] (61.424 ms) : 0, 61424
Debugger [candidate] (60.933 ms) : 0, 60933
Remote Config [baseline] (690.163 µs) : 0, 690
Remote Config [candidate] (691.97 µs) : 0, 692
Telemetry [baseline] (8.314 ms) : 0, 8314
Telemetry [candidate] (8.338 ms) : 0, 8338
Flare Poller [baseline] (3.922 ms) : 0, 3922
Flare Poller [candidate] (3.945 ms) : 0, 3945
IAST [baseline] (24.728 ms) : 0, 24728
IAST [candidate] (24.837 ms) : 0, 24837
section iast
crashtracking [baseline] (1.462 ms) : 0, 1462
crashtracking [candidate] (1.473 ms) : 0, 1473
BytebuddyAgent [baseline] (827.279 ms) : 0, 827279
BytebuddyAgent [candidate] (833.798 ms) : 0, 833798
GlobalTracer [baseline] (238.19 ms) : 0, 238190
GlobalTracer [candidate] (239.604 ms) : 0, 239604
AppSec [baseline] (32.334 ms) : 0, 32334
AppSec [candidate] (28.925 ms) : 0, 28925
Debugger [baseline] (60.648 ms) : 0, 60648
Debugger [candidate] (60.713 ms) : 0, 60713
Remote Config [baseline] (563.755 µs) : 0, 564
Remote Config [candidate] (554.85 µs) : 0, 555
Telemetry [baseline] (7.69 ms) : 0, 7690
Telemetry [candidate] (7.716 ms) : 0, 7716
Flare Poller [baseline] (3.486 ms) : 0, 3486
Flare Poller [candidate] (3.507 ms) : 0, 3507
IAST [baseline] (28.876 ms) : 0, 28876
IAST [candidate] (32.621 ms) : 0, 32621
section profiling
crashtracking [baseline] (1.458 ms) : 0, 1458
crashtracking [candidate] (1.473 ms) : 0, 1473
BytebuddyAgent [baseline] (733.351 ms) : 0, 733351
BytebuddyAgent [candidate] (739.366 ms) : 0, 739366
GlobalTracer [baseline] (222.773 ms) : 0, 222773
GlobalTracer [candidate] (224.826 ms) : 0, 224826
AppSec [baseline] (32.468 ms) : 0, 32468
AppSec [candidate] (33.554 ms) : 0, 33554
Debugger [baseline] (63.029 ms) : 0, 63029
Debugger [candidate] (63.117 ms) : 0, 63117
Remote Config [baseline] (717.841 µs) : 0, 718
Remote Config [candidate] (666.95 µs) : 0, 667
Telemetry [baseline] (7.99 ms) : 0, 7990
Telemetry [candidate] (8.164 ms) : 0, 8164
Flare Poller [baseline] (3.84 ms) : 0, 3840
Flare Poller [candidate] (3.826 ms) : 0, 3826
ProfilingAgent [baseline] (97.262 ms) : 0, 97262
ProfilingAgent [candidate] (97.773 ms) : 0, 97773
Profiling [baseline] (97.862 ms) : 0, 97862
Profiling [candidate] (98.358 ms) : 0, 98358
Loading

Load

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master mcculls/w3c-otel-baggage-interop-pt2
git_commit_date 1763457398 1763461219
git_commit_sha 6721645 9fa02e6
release_version 1.56.0-SNAPSHOT~6721645b9b 1.56.0-SNAPSHOT~9fa02e6d8a
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1763463651 1763463651
ci_job_id 1241381098 1241381098
ci_pipeline_id 82880419 82880419
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
kernel_version Linux runner-zfyrx7zua-project-304-concurrent-0-tuwbft92 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-zfyrx7zua-project-304-concurrent-0-tuwbft92 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 18 metrics, 18 unstable metrics.

Request duration reports for petclinic
gantt
    title petclinic - request duration [CI 0.99] : candidate=1.56.0-SNAPSHOT~9fa02e6d8a, baseline=1.56.0-SNAPSHOT~6721645b9b
    dateFormat X
    axisFormat %s
section baseline
no_agent (18.921 ms) : 18731, 19112
.   : milestone, 18921,
appsec (18.583 ms) : 18392, 18773
.   : milestone, 18583,
code_origins (17.674 ms) : 17503, 17846
.   : milestone, 17674,
iast (17.633 ms) : 17455, 17810
.   : milestone, 17633,
profiling (20.111 ms) : 19903, 20320
.   : milestone, 20111,
tracing (17.426 ms) : 17256, 17596
.   : milestone, 17426,
section candidate
no_agent (18.928 ms) : 18733, 19122
.   : milestone, 18928,
appsec (18.851 ms) : 18662, 19040
.   : milestone, 18851,
code_origins (17.69 ms) : 17513, 17868
.   : milestone, 17690,
iast (17.467 ms) : 17295, 17638
.   : milestone, 17467,
profiling (19.699 ms) : 19499, 19898
.   : milestone, 19699,
tracing (17.59 ms) : 17415, 17765
.   : milestone, 17590,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 18.921 ms [18.731 ms, 19.112 ms] -
appsec 18.583 ms [18.392 ms, 18.773 ms] -338.893 µs (-1.8%)
code_origins 17.674 ms [17.503 ms, 17.846 ms] -1.247 ms (-6.6%)
iast 17.633 ms [17.455 ms, 17.81 ms] -1.289 ms (-6.8%)
profiling 20.111 ms [19.903 ms, 20.32 ms] 1.19 ms (6.3%)
tracing 17.426 ms [17.256 ms, 17.596 ms] -1.495 ms (-7.9%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 18.928 ms [18.733 ms, 19.122 ms] -
appsec 18.851 ms [18.662 ms, 19.04 ms] -76.646 µs (-0.4%)
code_origins 17.69 ms [17.513 ms, 17.868 ms] -1.237 ms (-6.5%)
iast 17.467 ms [17.295 ms, 17.638 ms] -1.461 ms (-7.7%)
profiling 19.699 ms [19.499 ms, 19.898 ms] 770.862 µs (4.1%)
tracing 17.59 ms [17.415 ms, 17.765 ms] -1.338 ms (-7.1%)
Request duration reports for insecure-bank
gantt
    title insecure-bank - request duration [CI 0.99] : candidate=1.56.0-SNAPSHOT~9fa02e6d8a, baseline=1.56.0-SNAPSHOT~6721645b9b
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.2 ms) : 1187, 1212
.   : milestone, 1200,
iast (3.199 ms) : 3159, 3238
.   : milestone, 3199,
iast_FULL (5.769 ms) : 5677, 5861
.   : milestone, 5769,
iast_GLOBAL (3.463 ms) : 3411, 3516
.   : milestone, 3463,
profiling (2.073 ms) : 2054, 2092
.   : milestone, 2073,
tracing (1.786 ms) : 1771, 1801
.   : milestone, 1786,
section candidate
no_agent (1.187 ms) : 1176, 1198
.   : milestone, 1187,
iast (3.174 ms) : 3131, 3217
.   : milestone, 3174,
iast_FULL (5.76 ms) : 5676, 5843
.   : milestone, 5760,
iast_GLOBAL (3.542 ms) : 3491, 3592
.   : milestone, 3542,
profiling (2.158 ms) : 2139, 2177
.   : milestone, 2158,
tracing (1.829 ms) : 1813, 1844
.   : milestone, 1829,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 1.2 ms [1.187 ms, 1.212 ms] -
iast 3.199 ms [3.159 ms, 3.238 ms] 1.999 ms (166.6%)
iast_FULL 5.769 ms [5.677 ms, 5.861 ms] 4.569 ms (380.8%)
iast_GLOBAL 3.463 ms [3.411 ms, 3.516 ms] 2.263 ms (188.7%)
profiling 2.073 ms [2.054 ms, 2.092 ms] 873.533 µs (72.8%)
tracing 1.786 ms [1.771 ms, 1.801 ms] 586.291 µs (48.9%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 1.187 ms [1.176 ms, 1.198 ms] -
iast 3.174 ms [3.131 ms, 3.217 ms] 1.987 ms (167.4%)
iast_FULL 5.76 ms [5.676 ms, 5.843 ms] 4.573 ms (385.3%)
iast_GLOBAL 3.542 ms [3.491 ms, 3.592 ms] 2.355 ms (198.4%)
profiling 2.158 ms [2.139 ms, 2.177 ms] 971.008 µs (81.8%)
tracing 1.829 ms [1.813 ms, 1.844 ms] 641.713 µs (54.1%)

Dacapo

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master mcculls/w3c-otel-baggage-interop-pt2
git_commit_date 1763457398 1763461219
git_commit_sha 6721645 9fa02e6
release_version 1.56.0-SNAPSHOT~6721645b9b 1.56.0-SNAPSHOT~9fa02e6d8a
See matching parameters
Baseline Candidate
application biojava biojava
ci_job_date 1763463288 1763463288
ci_job_id 1241381100 1241381100
ci_pipeline_id 82880419 82880419
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-8wzxhjly 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-8wzxhjly 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

Summary

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

Execution time for tomcat
gantt
    title tomcat - execution time [CI 0.99] : candidate=1.56.0-SNAPSHOT~9fa02e6d8a, baseline=1.56.0-SNAPSHOT~6721645b9b
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.472 ms) : 1460, 1483
.   : milestone, 1472,
appsec (2.479 ms) : 2426, 2532
.   : milestone, 2479,
iast (2.209 ms) : 2145, 2272
.   : milestone, 2209,
iast_GLOBAL (2.248 ms) : 2184, 2313
.   : milestone, 2248,
profiling (2.475 ms) : 2254, 2697
.   : milestone, 2475,
tracing (2.032 ms) : 1982, 2082
.   : milestone, 2032,
section candidate
no_agent (1.473 ms) : 1462, 1485
.   : milestone, 1473,
appsec (3.703 ms) : 3485, 3922
.   : milestone, 3703,
iast (2.199 ms) : 2136, 2262
.   : milestone, 2199,
iast_GLOBAL (2.24 ms) : 2176, 2303
.   : milestone, 2240,
profiling (2.041 ms) : 1990, 2092
.   : milestone, 2041,
tracing (2.016 ms) : 1966, 2065
.   : milestone, 2016,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.472 ms [1.46 ms, 1.483 ms] -
appsec 2.479 ms [2.426 ms, 2.532 ms] 1.007 ms (68.4%)
iast 2.209 ms [2.145 ms, 2.272 ms] 736.832 µs (50.1%)
iast_GLOBAL 2.248 ms [2.184 ms, 2.313 ms] 776.596 µs (52.8%)
profiling 2.475 ms [2.254 ms, 2.697 ms] 1.004 ms (68.2%)
tracing 2.032 ms [1.982 ms, 2.082 ms] 560.108 µs (38.1%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.473 ms [1.462 ms, 1.485 ms] -
appsec 3.703 ms [3.485 ms, 3.922 ms] 2.23 ms (151.4%)
iast 2.199 ms [2.136 ms, 2.262 ms] 725.569 µs (49.3%)
iast_GLOBAL 2.24 ms [2.176 ms, 2.303 ms] 766.66 µs (52.0%)
profiling 2.041 ms [1.99 ms, 2.092 ms] 567.988 µs (38.6%)
tracing 2.016 ms [1.966 ms, 2.065 ms] 542.4 µs (36.8%)
Execution time for biojava
gantt
    title biojava - execution time [CI 0.99] : candidate=1.56.0-SNAPSHOT~9fa02e6d8a, baseline=1.56.0-SNAPSHOT~6721645b9b
    dateFormat X
    axisFormat %s
section baseline
no_agent (15.454 s) : 15454000, 15454000
.   : milestone, 15454000,
appsec (14.915 s) : 14915000, 14915000
.   : milestone, 14915000,
iast (18.627 s) : 18627000, 18627000
.   : milestone, 18627000,
iast_GLOBAL (17.799 s) : 17799000, 17799000
.   : milestone, 17799000,
profiling (14.721 s) : 14721000, 14721000
.   : milestone, 14721000,
tracing (14.928 s) : 14928000, 14928000
.   : milestone, 14928000,
section candidate
no_agent (14.977 s) : 14977000, 14977000
.   : milestone, 14977000,
appsec (14.98 s) : 14980000, 14980000
.   : milestone, 14980000,
iast (18.606 s) : 18606000, 18606000
.   : milestone, 18606000,
iast_GLOBAL (17.896 s) : 17896000, 17896000
.   : milestone, 17896000,
profiling (14.703 s) : 14703000, 14703000
.   : milestone, 14703000,
tracing (14.744 s) : 14744000, 14744000
.   : milestone, 14744000,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 15.454 s [15.454 s, 15.454 s] -
appsec 14.915 s [14.915 s, 14.915 s] -539.0 ms (-3.5%)
iast 18.627 s [18.627 s, 18.627 s] 3.173 s (20.5%)
iast_GLOBAL 17.799 s [17.799 s, 17.799 s] 2.345 s (15.2%)
profiling 14.721 s [14.721 s, 14.721 s] -733.0 ms (-4.7%)
tracing 14.928 s [14.928 s, 14.928 s] -526.0 ms (-3.4%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 14.977 s [14.977 s, 14.977 s] -
appsec 14.98 s [14.98 s, 14.98 s] 3.0 ms (0.0%)
iast 18.606 s [18.606 s, 18.606 s] 3.629 s (24.2%)
iast_GLOBAL 17.896 s [17.896 s, 17.896 s] 2.919 s (19.5%)
profiling 14.703 s [14.703 s, 14.703 s] -274.0 ms (-1.8%)
tracing 14.744 s [14.744 s, 14.744 s] -233.0 ms (-1.6%)

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.

Thanks for the explanations!

.put("FOO","OTEL_UNTOUCHED")
.put("remove_me_key", "otel_remove_me_value")
.build()
.makeCurrent()
Copy link
Contributor

Choose a reason for hiding this comment

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

Ahh that makes sense. We instrument the calls made to OTel Context and specify to use our OtelContext instead. Thanks for the explanation! :)

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. Proposed a possible performance improvement.

Comment on lines +84 to +87
Baggage baggage = Baggage.empty();
// transfer baggage to our internal container for propagation purposes
((io.opentelemetry.api.baggage.Baggage) value)
.forEach((k, b) -> baggage.addItem(k, b.getValue()));
Copy link
Contributor

@PerfectSlayer PerfectSlayer Nov 18, 2025

Choose a reason for hiding this comment

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

🎯 suggestion: ‏That might be an over optimization but (follow me here), what about implementing a custom Map implementation that projects the Map<String, BaggageEntry> returned by (OTel) Baggage.asMap() into a Map<String, String>?

We can then use (DD) Baggage.create(Map) from it, meaning having zero collection allocation as OTel uses the ReadOnlyArrayMap projection and we can have ours to translate value to their string counter parts.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One hiccup is that projection would be read-only - and our internal Baggage container has mutable operations (addItem / removeItem) that assume a mutable map.

So I'd prefer to do that as part of a refactoring to optimize the internal Baggage API, ideally making it inherently immutable once created/built.

@mcculls mcculls merged commit efa3210 into master Nov 18, 2025
538 checks passed
@mcculls mcculls deleted the mcculls/w3c-otel-baggage-interop-pt2 branch November 18, 2025 11:13
@github-actions github-actions bot added this to the 1.56.0 milestone Nov 18, 2025
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.

4 participants