test(otel): add unit tests for empty events/links flattening (#1198)#1584
test(otel): add unit tests for empty events/links flattening (#1198)#1584LeC-D wants to merge 1 commit intoparseablehq:mainfrom
Conversation
…lehq#1198) Document the expected behaviour of flatten_events and flatten_links when called with empty slices, and the fall-back logic inside flatten_span_record that the PR parseablehq#1196 fix relies on: - test_flatten_events_empty_slice: flatten_events(&[]) returns [] - test_flatten_links_empty_slice: flatten_links(&[]) returns [] - test_flatten_span_record_events_only_no_links: span with events but no links produces one record per event, each enriched with span fields - test_flatten_span_record_links_only_no_events: span with links but no events produces one record per link, each enriched with span fields
|
CLA Assistant Lite bot: I have read the CLA Document and I hereby sign the CLA Léo (LeC-D) seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughUnit tests were added to validate the behavior of event and link flattening functions in the OpenTelemetry traces module. Tests cover empty input edge cases and verify that enriched span fields are correctly included in flattened records for both events and links. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
Closes #1198
What
Adds four targeted unit tests to
src/otel/traces.rsthat document the expected behaviour of the specialised flattening logic introduced in #1196 (emptyEvents/Linksin OTel spans):test_flatten_events_empty_sliceflatten_events(&[])returns an emptyVectest_flatten_links_empty_sliceflatten_links(&[])returns an emptyVectest_flatten_span_record_events_only_no_linkstest_flatten_span_record_links_only_no_eventsThe
if span_records_json.is_empty()branch inflatten_span_recordis the critical path for the #1196 fix; these tests pin its contract so that any future refactor that breaks the fallback will be caught immediately.Summary by CodeRabbit
Release Notes