Skip to content

fix: stop metrics otap encode panic#2984

Draft
larry-c-ef wants to merge 1 commit into
open-telemetry:mainfrom
elastiflow:fix-encode_metrics_otap_batch-panic
Draft

fix: stop metrics otap encode panic#2984
larry-c-ef wants to merge 1 commit into
open-telemetry:mainfrom
elastiflow:fix-encode_metrics_otap_batch-panic

Conversation

@larry-c-ef
Copy link
Copy Markdown

Stop metrics otap encode panic on otl bytes cursor misuse, and on missing resource.

  • Avoid draining the shared OTLP proto-bytes metrics() cursor (no pre-loop metrics().count()); emit scope/schema columns per metric instead.
  • Handle ResourceMetrics with no resource by still appending resource rows so Arrow struct lengths stay consistent.

These changes fix a panic due to column mismatch in MetricsRecordBatchBuilder::finish.

Tests

  • add regression tests (proto struct + realistic export bytes with catch_unwind)
  • add realistic export request fixture and source log under crates/pdata/testdata

Change Summary

What issue does this PR close?

  • Closes #NNN

How are these changes tested?

Are there any user-facing changes?

Stop metrics otap encode panic on otl bytes cursor misuse, and on
missing resource.

- Avoid draining the shared OTLP proto-bytes metrics() cursor (no
  pre-loop metrics().count()); emit scope/schema columns per metric
  instead.
- Handle ResourceMetrics with no resource by still appending resource
  rows so Arrow struct lengths stay consistent.

These changes fix a panic due to column mismatch in
MetricsRecordBatchBuilder::finish.

Tests

- add regression tests (proto struct + realistic export bytes with
  catch_unwind)
- add realistic export request fixture and source log under
  crates/pdata/testdata
@linux-foundation-easycla
Copy link
Copy Markdown

CLA Not Signed

@github-actions github-actions Bot added the rust Pull requests that update Rust code label May 15, 2026
@larry-c-ef
Copy link
Copy Markdown
Author

I created this draft so my company could get the ball rolling on the CLA. I will revise it later.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 19, 2026

Codecov Report

❌ Patch coverage is 97.01493% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.92%. Comparing base (40b4f4d) to head (ba5f986).
⚠️ Report is 25 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2984      +/-   ##
==========================================
+ Coverage   85.90%   85.92%   +0.01%     
==========================================
  Files         725      725              
  Lines      275426   275657     +231     
==========================================
+ Hits       236617   236852     +235     
+ Misses      38285    38281       -4     
  Partials      524      524              
Components Coverage Δ
otap-dataflow 87.04% <97.01%> (+0.01%) ⬆️
query_abstraction 80.61% <ø> (ø)
query_engine 89.57% <ø> (ø)
otel-arrow-go 52.45% <ø> (ø)
quiver 92.25% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rust Pull requests that update Rust code

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant