← Back to Pull requests

perf(otlp-transformer): single pass protobuf serializer #7302

Closed
unknown closed this pull request without merging on Nov 19, 2026 09:29 UTC
View on GitHub
unknown unknown commented on Nov 11, 2026 21:13 UTC
Author

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 the ProtobufWriter to 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.js cases 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.

  • Internal performance improvement
  • How Has This Been Tested?

  • Tests passed

  • Added a large data benchmark
  • Checklist:

  • Followed the style guidelines of this project

  • Unit tests have been added

  • ~~Documentation has been updated~~
  • Diff: 252 lines (+189 / -63) across 3 files Reviewer: legendecas Review duration: 10816m
    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
    0.39
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    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
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 39% (MEDIUM) · Higher = larger blast radius
    39%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 15.4% · Safe to merge
    15.4%