perf(otlp-transformer): single pass protobuf serializer #7302
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 252 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.331
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #7302"
general
weight: 0.35
legendecas
Which problem is this PR solving?
I was testing if the writer can be improved with https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/resize but it turns out that removing the first pass of size estimation could already improve the serialization significantly.
protobuf-js does single pass serialization as well. TL;DR: every benchmark case shows a better result.
Short description of the changes
This removes the first pass
ProtobufSizeEstimator. Also updated theProtobufWriterto start with 1 KB buffer size.Benchmarks
Result with ops/s, higher the better.
Typical batches (spans/s, 6 rounds)
| case | main | this PR | change |
|---|---|---|---|
| 100 spans, 6 short attributes | 511,953 | 878,329 | 1.72x |
| 512 spans, 6 short attributes | 503,646 | 848,454 | 1.68x |
| 100 spans + exception with long CJK/emoji stack | 286,420 | 453,369 | 1.58x |
| 100 spans + exception with long ASCII stack | 302,327 | 488,558 | 1.62x |
| 100 spans, 32 attributes | 125,916 | 216,579 | 1.72x |
| 100 spans + 2 multi-byte attributes | 388,941 | 641,018 | 1.65x |
Small requests (requests/s, 4 rounds)
| case | main | this PR | change |
|---|---|---|---|
| 1 span (411 B) | 345,051 | 579,146 | 1.68x |
| 10 spans (3.1 KB) | 50,324 | 83,528 | 1.66x |
Also added a new
trace-batches.jscases that covers 512 spans with one large attribute. Each case ran alone, 3 interleaved runs.Large requests (
trace-batches.js, 512 spans with one large attribute, ops/s, 4 rounds)| request size | main | this PR | change |
|---|---|---|---|
| 2.2 MB | 605 | 816 | 1.35x |
| 8.5 MB | 235 | 316 | 1.35x |
| 33.7 MB | 67.7 | 84.7 | 1.25x |
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Checklist: