Skip to content

Provide optimized writers for OpenTelemetry's "trace.proto" wire protocol#11120

Open
mcculls wants to merge 15 commits intomasterfrom
mcculls/otlp-traces-proto
Open

Provide optimized writers for OpenTelemetry's "trace.proto" wire protocol#11120
mcculls wants to merge 15 commits intomasterfrom
mcculls/otlp-traces-proto

Conversation

@mcculls
Copy link
Copy Markdown
Contributor

@mcculls mcculls commented Apr 15, 2026

What Does This Do

Uses a single temporary buffer as in #10983 to prepare message chunks at different nesting levels (resource / scope / span)

First we chunk all nested messages, i.e. span-links, for a given span. Once the span is complete we add the first part of the span message and its chunked links to the scoped chunks. Once the scope is complete we add the first part of the scoped spans message and all its chunks (span messages and their links) to the payload. Once all the span data has been chunked we add the enclosing resource metrics message to the start of the payload.

Multiple traces can be added to the collector before collecting them into a payload. Note that this payload is only valid for the calling thread until the next collection. Adding traces after collection automatically starts a new payload.

Motivation

Avoids need to use full protobuf library while keeping intermediate array creation to a minimum.

Additional Notes

OtlpTraceProtoTest was created with the help of Claude.

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.

@mcculls mcculls added tag: do not merge Do not merge changes type: feature request inst: opentelemetry OpenTelemetry instrumentation labels Apr 15, 2026
@pr-commenter
Copy link
Copy Markdown

pr-commenter bot commented Apr 15, 2026

Benchmarks

Startup

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master mcculls/otlp-traces-proto
git_commit_date 1776423906 1776434376
git_commit_sha d5d2097 f5eae6e
release_version 1.62.0-SNAPSHOT~d5d2097cb9 1.62.0-SNAPSHOT~f5eae6e507
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1776436392 1776436392
ci_job_id 1605784694 1605784694
ci_pipeline_id 108243167 108243167
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-ufmco4f0 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-ufmco4f0 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 64 metrics, 7 unstable metrics.

Startup time reports for insecure-bank
gantt
    title insecure-bank - global startup overhead: candidate=1.62.0-SNAPSHOT~f5eae6e507, baseline=1.62.0-SNAPSHOT~d5d2097cb9

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.058 s) : 0, 1058335
Total [baseline] (8.859 s) : 0, 8859052
Agent [candidate] (1.059 s) : 0, 1058768
Total [candidate] (8.872 s) : 0, 8871675
section iast
Agent [baseline] (1.229 s) : 0, 1229364
Total [baseline] (9.581 s) : 0, 9580947
Agent [candidate] (1.233 s) : 0, 1233021
Total [candidate] (9.596 s) : 0, 9595985
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.058 s -
Agent iast 1.229 s 171.029 ms (16.2%)
Total tracing 8.859 s -
Total iast 9.581 s 721.895 ms (8.1%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.059 s -
Agent iast 1.233 s 174.252 ms (16.5%)
Total tracing 8.872 s -
Total iast 9.596 s 724.31 ms (8.2%)
gantt
    title insecure-bank - break down per module: candidate=1.62.0-SNAPSHOT~f5eae6e507, baseline=1.62.0-SNAPSHOT~d5d2097cb9

    dateFormat X
    axisFormat %s
section tracing
crashtracking [baseline] (1.251 ms) : 0, 1251
crashtracking [candidate] (1.245 ms) : 0, 1245
BytebuddyAgent [baseline] (633.791 ms) : 0, 633791
BytebuddyAgent [candidate] (634.093 ms) : 0, 634093
AgentMeter [baseline] (29.438 ms) : 0, 29438
AgentMeter [candidate] (29.628 ms) : 0, 29628
GlobalTracer [baseline] (249.234 ms) : 0, 249234
GlobalTracer [candidate] (249.875 ms) : 0, 249875
AppSec [baseline] (32.604 ms) : 0, 32604
AppSec [candidate] (32.477 ms) : 0, 32477
Debugger [baseline] (59.644 ms) : 0, 59644
Debugger [candidate] (59.203 ms) : 0, 59203
Remote Config [baseline] (591.738 µs) : 0, 592
Remote Config [candidate] (597.966 µs) : 0, 598
Telemetry [baseline] (8.11 ms) : 0, 8110
Telemetry [candidate] (8.026 ms) : 0, 8026
Flare Poller [baseline] (7.492 ms) : 0, 7492
Flare Poller [candidate] (7.336 ms) : 0, 7336
section iast
crashtracking [baseline] (1.25 ms) : 0, 1250
crashtracking [candidate] (1.232 ms) : 0, 1232
BytebuddyAgent [baseline] (805.814 ms) : 0, 805814
BytebuddyAgent [candidate] (805.76 ms) : 0, 805760
AgentMeter [baseline] (11.617 ms) : 0, 11617
AgentMeter [candidate] (11.787 ms) : 0, 11787
GlobalTracer [baseline] (239.391 ms) : 0, 239391
GlobalTracer [candidate] (242.044 ms) : 0, 242044
AppSec [baseline] (31.285 ms) : 0, 31285
AppSec [candidate] (31.555 ms) : 0, 31555
Debugger [baseline] (64.339 ms) : 0, 64339
Debugger [candidate] (64.741 ms) : 0, 64741
Remote Config [baseline] (536.951 µs) : 0, 537
Remote Config [candidate] (545.724 µs) : 0, 546
Telemetry [baseline] (9.319 ms) : 0, 9319
Telemetry [candidate] (9.379 ms) : 0, 9379
Flare Poller [baseline] (3.589 ms) : 0, 3589
Flare Poller [candidate] (3.631 ms) : 0, 3631
IAST [baseline] (25.864 ms) : 0, 25864
IAST [candidate] (26.176 ms) : 0, 26176
Loading
Startup time reports for petclinic
gantt
    title petclinic - global startup overhead: candidate=1.62.0-SNAPSHOT~f5eae6e507, baseline=1.62.0-SNAPSHOT~d5d2097cb9

    dateFormat X
    axisFormat %s
section tracing
Agent [baseline] (1.066 s) : 0, 1066011
Total [baseline] (11.13 s) : 0, 11129697
Agent [candidate] (1.058 s) : 0, 1058455
Total [candidate] (11.134 s) : 0, 11133956
section appsec
Agent [baseline] (1.25 s) : 0, 1249692
Total [baseline] (11.033 s) : 0, 11032701
Agent [candidate] (1.257 s) : 0, 1256956
Total [candidate] (11.168 s) : 0, 11168222
section iast
Agent [baseline] (1.228 s) : 0, 1227782
Total [baseline] (11.289 s) : 0, 11288754
Agent [candidate] (1.226 s) : 0, 1226457
Total [candidate] (11.313 s) : 0, 11312519
section profiling
Agent [baseline] (1.187 s) : 0, 1186530
Total [baseline] (11.039 s) : 0, 11039321
Agent [candidate] (1.184 s) : 0, 1184278
Total [candidate] (10.948 s) : 0, 10947831
Loading
  • baseline results
Module Variant Duration Δ tracing
Agent tracing 1.066 s -
Agent appsec 1.25 s 183.681 ms (17.2%)
Agent iast 1.228 s 161.771 ms (15.2%)
Agent profiling 1.187 s 120.519 ms (11.3%)
Total tracing 11.13 s -
Total appsec 11.033 s -96.996 ms (-0.9%)
Total iast 11.289 s 159.057 ms (1.4%)
Total profiling 11.039 s -90.376 ms (-0.8%)
  • candidate results
Module Variant Duration Δ tracing
Agent tracing 1.058 s -
Agent appsec 1.257 s 198.501 ms (18.8%)
Agent iast 1.226 s 168.002 ms (15.9%)
Agent profiling 1.184 s 125.822 ms (11.9%)
Total tracing 11.134 s -
Total appsec 11.168 s 34.266 ms (0.3%)
Total iast 11.313 s 178.563 ms (1.6%)
Total profiling 10.948 s -186.125 ms (-1.7%)
gantt
    title petclinic - break down per module: candidate=1.62.0-SNAPSHOT~f5eae6e507, baseline=1.62.0-SNAPSHOT~d5d2097cb9

    dateFormat X
    axisFormat %s
section tracing
crashtracking [baseline] (1.258 ms) : 0, 1258
crashtracking [candidate] (1.231 ms) : 0, 1231
BytebuddyAgent [baseline] (637.379 ms) : 0, 637379
BytebuddyAgent [candidate] (632.403 ms) : 0, 632403
AgentMeter [baseline] (29.708 ms) : 0, 29708
AgentMeter [candidate] (29.472 ms) : 0, 29472
GlobalTracer [baseline] (250.241 ms) : 0, 250241
GlobalTracer [candidate] (249.472 ms) : 0, 249472
AppSec [baseline] (32.639 ms) : 0, 32639
AppSec [candidate] (32.344 ms) : 0, 32344
Debugger [baseline] (60.53 ms) : 0, 60530
Debugger [candidate] (59.742 ms) : 0, 59742
Remote Config [baseline] (603.21 µs) : 0, 603
Remote Config [candidate] (620.5 µs) : 0, 620
Telemetry [baseline] (8.158 ms) : 0, 8158
Telemetry [candidate] (7.985 ms) : 0, 7985
Flare Poller [baseline] (9.165 ms) : 0, 9165
Flare Poller [candidate] (8.985 ms) : 0, 8985
section appsec
crashtracking [baseline] (1.227 ms) : 0, 1227
crashtracking [candidate] (1.223 ms) : 0, 1223
BytebuddyAgent [baseline] (662.025 ms) : 0, 662025
BytebuddyAgent [candidate] (665.396 ms) : 0, 665396
AgentMeter [baseline] (12.295 ms) : 0, 12295
AgentMeter [candidate] (12.386 ms) : 0, 12386
GlobalTracer [baseline] (249.392 ms) : 0, 249392
GlobalTracer [candidate] (250.995 ms) : 0, 250995
AppSec [baseline] (185.272 ms) : 0, 185272
AppSec [candidate] (186.591 ms) : 0, 186591
Debugger [baseline] (65.811 ms) : 0, 65811
Debugger [candidate] (66.379 ms) : 0, 66379
Remote Config [baseline] (606.745 µs) : 0, 607
Remote Config [candidate] (602.249 µs) : 0, 602
Telemetry [baseline] (8.519 ms) : 0, 8519
Telemetry [candidate] (8.641 ms) : 0, 8641
Flare Poller [baseline] (3.555 ms) : 0, 3555
Flare Poller [candidate] (3.588 ms) : 0, 3588
IAST [baseline] (24.522 ms) : 0, 24522
IAST [candidate] (24.672 ms) : 0, 24672
section iast
crashtracking [baseline] (1.235 ms) : 0, 1235
crashtracking [candidate] (1.218 ms) : 0, 1218
BytebuddyAgent [baseline] (803.882 ms) : 0, 803882
BytebuddyAgent [candidate] (801.347 ms) : 0, 801347
AgentMeter [baseline] (11.597 ms) : 0, 11597
AgentMeter [candidate] (11.639 ms) : 0, 11639
GlobalTracer [baseline] (239.099 ms) : 0, 239099
GlobalTracer [candidate] (240.002 ms) : 0, 240002
AppSec [baseline] (30.625 ms) : 0, 30625
AppSec [candidate] (33.711 ms) : 0, 33711
Debugger [baseline] (65.746 ms) : 0, 65746
Debugger [candidate] (62.631 ms) : 0, 62631
Remote Config [baseline] (532.964 µs) : 0, 533
Remote Config [candidate] (526.874 µs) : 0, 527
Telemetry [baseline] (9.349 ms) : 0, 9349
Telemetry [candidate] (9.638 ms) : 0, 9638
Flare Poller [baseline] (3.67 ms) : 0, 3670
Flare Poller [candidate] (3.648 ms) : 0, 3648
IAST [baseline] (25.733 ms) : 0, 25733
IAST [candidate] (25.851 ms) : 0, 25851
section profiling
crashtracking [baseline] (1.187 ms) : 0, 1187
crashtracking [candidate] (1.185 ms) : 0, 1185
BytebuddyAgent [baseline] (693.128 ms) : 0, 693128
BytebuddyAgent [candidate] (691.641 ms) : 0, 691641
AgentMeter [baseline] (9.19 ms) : 0, 9190
AgentMeter [candidate] (9.186 ms) : 0, 9186
GlobalTracer [baseline] (207.031 ms) : 0, 207031
GlobalTracer [candidate] (207.196 ms) : 0, 207196
AppSec [baseline] (32.863 ms) : 0, 32863
AppSec [candidate] (32.77 ms) : 0, 32770
Debugger [baseline] (65.898 ms) : 0, 65898
Debugger [candidate] (65.412 ms) : 0, 65412
Remote Config [baseline] (579.049 µs) : 0, 579
Remote Config [candidate] (581.216 µs) : 0, 581
Telemetry [baseline] (7.775 ms) : 0, 7775
Telemetry [candidate] (7.735 ms) : 0, 7735
Flare Poller [baseline] (3.53 ms) : 0, 3530
Flare Poller [candidate] (3.529 ms) : 0, 3529
ProfilingAgent [baseline] (94.003 ms) : 0, 94003
ProfilingAgent [candidate] (93.718 ms) : 0, 93718
Profiling [baseline] (94.562 ms) : 0, 94562
Profiling [candidate] (94.283 ms) : 0, 94283
Loading

Load

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master mcculls/otlp-traces-proto
git_commit_date 1776423906 1776434376
git_commit_sha d5d2097 f5eae6e
release_version 1.62.0-SNAPSHOT~d5d2097cb9 1.62.0-SNAPSHOT~f5eae6e507
See matching parameters
Baseline Candidate
application insecure-bank insecure-bank
ci_job_date 1776436972 1776436972
ci_job_id 1605784696 1605784696
ci_pipeline_id 108243167 108243167
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-090snax1 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-090snax1 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 4 performance improvements and 0 performance regressions! Performance is the same for 15 metrics, 17 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:insecure-bank:iast_GLOBAL:high_load unsure
[-129.100µs; -25.348µs] or [-4.315%; -0.847%]
better
[-562.994µs; -172.042µs] or [-6.622%; -2.024%]
unstable
[-98.160op/s; +180.660op/s] or [-8.135%; +14.972%]
2.915ms 8.134ms 1247.906op/s 2.992ms 8.502ms 1206.656op/s
scenario:load:insecure-bank:profiling:high_load better
[-151.036µs; -53.542µs] or [-8.648%; -3.066%]
unstable
[-1139.045µs; -427.353µs] or [-22.100%; -8.292%]
unstable
[-40.472op/s; +470.222op/s] or [-1.954%; +22.703%]
1.644ms 4.371ms 2286.094op/s 1.747ms 5.154ms 2071.219op/s
scenario:load:petclinic:tracing:high_load better
[-1.758ms; -0.752ms] or [-9.467%; -4.048%]
unsure
[-1.953ms; -0.263ms] or [-6.594%; -0.887%]
unstable
[-12.762op/s; +42.075op/s] or [-5.133%; +16.923%]
17.313ms 28.514ms 263.281op/s 18.568ms 29.622ms 248.625op/s
scenario:load:petclinic:code_origins:high_load unsure
[-603.374µs; -228.262µs] or [-3.416%; -1.292%]
better
[-1.789ms; -0.697ms] or [-6.115%; -2.383%]
unstable
[-20.851op/s; +33.726op/s] or [-8.093%; +13.091%]
17.246ms 28.008ms 264.062op/s 17.662ms 29.250ms 257.625op/s
Request duration reports for petclinic
gantt
    title petclinic - request duration [CI 0.99] : candidate=1.62.0-SNAPSHOT~f5eae6e507, baseline=1.62.0-SNAPSHOT~d5d2097cb9
    dateFormat X
    axisFormat %s
section baseline
no_agent (18.256 ms) : 18065, 18447
.   : milestone, 18256,
appsec (18.651 ms) : 18462, 18840
.   : milestone, 18651,
code_origins (18.113 ms) : 17932, 18295
.   : milestone, 18113,
iast (17.627 ms) : 17454, 17801
.   : milestone, 17627,
profiling (18.569 ms) : 18387, 18752
.   : milestone, 18569,
tracing (18.772 ms) : 18584, 18961
.   : milestone, 18772,
section candidate
no_agent (17.467 ms) : 17291, 17643
.   : milestone, 17467,
appsec (18.555 ms) : 18370, 18739
.   : milestone, 18555,
code_origins (17.665 ms) : 17492, 17838
.   : milestone, 17665,
iast (18.108 ms) : 17927, 18289
.   : milestone, 18108,
profiling (18.371 ms) : 18190, 18553
.   : milestone, 18371,
tracing (17.722 ms) : 17547, 17897
.   : milestone, 17722,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 18.256 ms [18.065 ms, 18.447 ms] -
appsec 18.651 ms [18.462 ms, 18.84 ms] 395.042 µs (2.2%)
code_origins 18.113 ms [17.932 ms, 18.295 ms] -142.616 µs (-0.8%)
iast 17.627 ms [17.454 ms, 17.801 ms] -628.438 µs (-3.4%)
profiling 18.569 ms [18.387 ms, 18.752 ms] 313.513 µs (1.7%)
tracing 18.772 ms [18.584 ms, 18.961 ms] 516.588 µs (2.8%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 17.467 ms [17.291 ms, 17.643 ms] -
appsec 18.555 ms [18.37 ms, 18.739 ms] 1.088 ms (6.2%)
code_origins 17.665 ms [17.492 ms, 17.838 ms] 198.159 µs (1.1%)
iast 18.108 ms [17.927 ms, 18.289 ms] 641.115 µs (3.7%)
profiling 18.371 ms [18.19 ms, 18.553 ms] 904.271 µs (5.2%)
tracing 17.722 ms [17.547 ms, 17.897 ms] 255.145 µs (1.5%)
Request duration reports for insecure-bank
gantt
    title insecure-bank - request duration [CI 0.99] : candidate=1.62.0-SNAPSHOT~f5eae6e507, baseline=1.62.0-SNAPSHOT~d5d2097cb9
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.26 ms) : 1248, 1272
.   : milestone, 1260,
iast (3.369 ms) : 3320, 3419
.   : milestone, 3369,
iast_FULL (5.99 ms) : 5929, 6052
.   : milestone, 5990,
iast_GLOBAL (3.805 ms) : 3739, 3871
.   : milestone, 3805,
profiling (2.184 ms) : 2163, 2205
.   : milestone, 2184,
tracing (1.948 ms) : 1931, 1965
.   : milestone, 1948,
section candidate
no_agent (1.244 ms) : 1232, 1257
.   : milestone, 1244,
iast (3.408 ms) : 3360, 3455
.   : milestone, 3408,
iast_FULL (5.966 ms) : 5906, 6027
.   : milestone, 5966,
iast_GLOBAL (3.677 ms) : 3617, 3736
.   : milestone, 3677,
profiling (1.972 ms) : 1956, 1988
.   : milestone, 1972,
tracing (1.89 ms) : 1874, 1906
.   : milestone, 1890,
Loading
  • baseline results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 1.26 ms [1.248 ms, 1.272 ms] -
iast 3.369 ms [3.32 ms, 3.419 ms] 2.109 ms (167.4%)
iast_FULL 5.99 ms [5.929 ms, 6.052 ms] 4.73 ms (375.4%)
iast_GLOBAL 3.805 ms [3.739 ms, 3.871 ms] 2.545 ms (201.9%)
profiling 2.184 ms [2.163 ms, 2.205 ms] 923.781 µs (73.3%)
tracing 1.948 ms [1.931 ms, 1.965 ms] 687.341 µs (54.5%)
  • candidate results
Variant Request duration [CI 0.99] Δ no_agent
no_agent 1.244 ms [1.232 ms, 1.257 ms] -
iast 3.408 ms [3.36 ms, 3.455 ms] 2.163 ms (173.8%)
iast_FULL 5.966 ms [5.906 ms, 6.027 ms] 4.722 ms (379.4%)
iast_GLOBAL 3.677 ms [3.617 ms, 3.736 ms] 2.432 ms (195.4%)
profiling 1.972 ms [1.956 ms, 1.988 ms] 727.15 µs (58.4%)
tracing 1.89 ms [1.874 ms, 1.906 ms] 645.545 µs (51.9%)

Dacapo

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch master mcculls/otlp-traces-proto
git_commit_date 1776423906 1776434376
git_commit_sha d5d2097 f5eae6e
release_version 1.62.0-SNAPSHOT~d5d2097cb9 1.62.0-SNAPSHOT~f5eae6e507
See matching parameters
Baseline Candidate
application biojava biojava
ci_job_date 1776436659 1776436659
ci_job_id 1605784700 1605784700
ci_pipeline_id 108243167 108243167
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-3h5yjimn 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-3h5yjimn 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.62.0-SNAPSHOT~f5eae6e507, baseline=1.62.0-SNAPSHOT~d5d2097cb9
    dateFormat X
    axisFormat %s
section baseline
no_agent (1.487 ms) : 1475, 1498
.   : milestone, 1487,
appsec (3.852 ms) : 3630, 4073
.   : milestone, 3852,
iast (2.272 ms) : 2203, 2342
.   : milestone, 2272,
iast_GLOBAL (2.316 ms) : 2246, 2386
.   : milestone, 2316,
profiling (2.099 ms) : 2044, 2154
.   : milestone, 2099,
tracing (2.086 ms) : 2032, 2140
.   : milestone, 2086,
section candidate
no_agent (1.483 ms) : 1471, 1494
.   : milestone, 1483,
appsec (3.829 ms) : 3606, 4051
.   : milestone, 3829,
iast (2.27 ms) : 2200, 2340
.   : milestone, 2270,
iast_GLOBAL (2.318 ms) : 2248, 2388
.   : milestone, 2318,
profiling (2.099 ms) : 2044, 2154
.   : milestone, 2099,
tracing (2.095 ms) : 2041, 2149
.   : milestone, 2095,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.487 ms [1.475 ms, 1.498 ms] -
appsec 3.852 ms [3.63 ms, 4.073 ms] 2.365 ms (159.1%)
iast 2.272 ms [2.203 ms, 2.342 ms] 785.558 µs (52.8%)
iast_GLOBAL 2.316 ms [2.246 ms, 2.386 ms] 829.402 µs (55.8%)
profiling 2.099 ms [2.044 ms, 2.154 ms] 612.573 µs (41.2%)
tracing 2.086 ms [2.032 ms, 2.14 ms] 599.523 µs (40.3%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 1.483 ms [1.471 ms, 1.494 ms] -
appsec 3.829 ms [3.606 ms, 4.051 ms] 2.346 ms (158.2%)
iast 2.27 ms [2.2 ms, 2.34 ms] 787.118 µs (53.1%)
iast_GLOBAL 2.318 ms [2.248 ms, 2.388 ms] 835.255 µs (56.3%)
profiling 2.099 ms [2.044 ms, 2.154 ms] 616.365 µs (41.6%)
tracing 2.095 ms [2.041 ms, 2.149 ms] 612.228 µs (41.3%)
Execution time for biojava
gantt
    title biojava - execution time [CI 0.99] : candidate=1.62.0-SNAPSHOT~f5eae6e507, baseline=1.62.0-SNAPSHOT~d5d2097cb9
    dateFormat X
    axisFormat %s
section baseline
no_agent (15.21 s) : 15210000, 15210000
.   : milestone, 15210000,
appsec (14.8 s) : 14800000, 14800000
.   : milestone, 14800000,
iast (18.397 s) : 18397000, 18397000
.   : milestone, 18397000,
iast_GLOBAL (18.29 s) : 18290000, 18290000
.   : milestone, 18290000,
profiling (14.756 s) : 14756000, 14756000
.   : milestone, 14756000,
tracing (14.684 s) : 14684000, 14684000
.   : milestone, 14684000,
section candidate
no_agent (14.912 s) : 14912000, 14912000
.   : milestone, 14912000,
appsec (14.99 s) : 14990000, 14990000
.   : milestone, 14990000,
iast (18.55 s) : 18550000, 18550000
.   : milestone, 18550000,
iast_GLOBAL (17.94 s) : 17940000, 17940000
.   : milestone, 17940000,
profiling (15.103 s) : 15103000, 15103000
.   : milestone, 15103000,
tracing (14.859 s) : 14859000, 14859000
.   : milestone, 14859000,
Loading
  • baseline results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 15.21 s [15.21 s, 15.21 s] -
appsec 14.8 s [14.8 s, 14.8 s] -410.0 ms (-2.7%)
iast 18.397 s [18.397 s, 18.397 s] 3.187 s (21.0%)
iast_GLOBAL 18.29 s [18.29 s, 18.29 s] 3.08 s (20.2%)
profiling 14.756 s [14.756 s, 14.756 s] -454.0 ms (-3.0%)
tracing 14.684 s [14.684 s, 14.684 s] -526.0 ms (-3.5%)
  • candidate results
Variant Execution Time [CI 0.99] Δ no_agent
no_agent 14.912 s [14.912 s, 14.912 s] -
appsec 14.99 s [14.99 s, 14.99 s] 78.0 ms (0.5%)
iast 18.55 s [18.55 s, 18.55 s] 3.638 s (24.4%)
iast_GLOBAL 17.94 s [17.94 s, 17.94 s] 3.028 s (20.3%)
profiling 15.103 s [15.103 s, 15.103 s] 191.0 ms (1.3%)
tracing 14.859 s [14.859 s, 14.859 s] -53.0 ms (-0.4%)

@mcculls mcculls force-pushed the mcculls/otlp-traces-proto branch 2 times, most recently from 583dc0c to 4adb56e Compare April 15, 2026 17:53
@mcculls mcculls changed the title WIP: Provide optimized writers for OpenTelemetry's "trace.proto" wire protocol Provide optimized writers for OpenTelemetry's "trace.proto" wire protocol Apr 15, 2026
@mcculls mcculls marked this pull request as ready for review April 15, 2026 17:56
@mcculls mcculls requested a review from a team as a code owner April 15, 2026 17:56
@mcculls mcculls requested review from mtoffl01 and ygree and removed request for ygree April 15, 2026 17:56
@mcculls mcculls removed the tag: do not merge Do not merge changes label Apr 15, 2026
Comment on lines +59 to +65
/**
* Collects trace spans and marshalls them into a chunked payload.
*
* <p>This payload is only valid for the calling thread until the next collection.
*/
@Override
public OtlpPayload collectSpans(List<DDSpan> spans) {
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.

Is List<DDSpan> spans expected to be spans from a single trace? If so, each collectSpans call produces a full TracesData envelope with resource and scope wrappers per trace. This doesn't seem optimal and differs from the Datadog/msgpack implementation? Unless the expectation is that the eventual OtlpWriter will accumulated completed traces and call this once per flush cycle with a combined span list (although that can't be right based on the MetaWriter, which expects just a single trace at a time).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Very good point - on reflection I'll change this to add a flush method so we can accumulate trace chunks over multiple calls.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

OK, I've updated the collector API so it has two methods:

  • addTrace(spans) which adds a trace to the collector
  • collectTraces() which marshals the collected spans into a payload

This should allow its use as a replacement PayloadDispatcher, which means we can re-use more of the existing remote writer code.

Comment thread dd-trace-core/src/main/java/datadog/trace/core/otlp/trace/OtlpTraceProto.java Outdated
@mcculls mcculls force-pushed the mcculls/otlp-traces-proto branch from ab2ef0b to 7cdfed7 Compare April 17, 2026 11:53
@mcculls mcculls requested a review from a team as a code owner April 17, 2026 11:53
@mcculls mcculls requested review from dougqh and removed request for a team April 17, 2026 11:53
writeSpanTag(buf, PROCESS_TAGS_KEY, metadata.processTags());
}

metadata.getTags().forEach(tagEntry -> writeSpanTag(buf, tagEntry));
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.

Full-disclosure, I did just quickly run this through Claude.
It did catch that this is introducing a capturing lambda.
TagMap has helper routines to avoid the lambda capture by doing...
forEach(buf, (b, tagEntry) -> ...);

I suppose to avoid capture entirely. You need two variables, but that is also supported.

  1. Per-span lambda allocations — OtlpTraceProto.java:312 and :182-186
    metadata.getTags().forEach(tagEntry -> writeSpanTag(buf, tagEntry));
    This is a capturing lambda (captures buf); it allocates a fresh object on every accept() call. MetaWriter already holds buf as a field — hoist a
    Consumer<TagMap.EntryReader> into the instance and reuse it. Same applies to the BiConsumer inside recordSpanLinkMessage. On hot paths this compounds with
    the per-span spanLink.attributes().asMap() which likely allocates an EntrySet wrapper + iterator per span.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

interesting, thanks!

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.

3 participants