Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid vec allocation during each export for BatchLogProcessor - Part 2 #2488

Merged
merged 6 commits into from
Dec 31, 2024

Conversation

utpilla
Copy link
Contributor

@utpilla utpilla commented Dec 30, 2024

For batch export, we create an additional vec just to hold the references to LogRecord and InstrumentationScope. This is needed because the constructor for LogBatch only accepts a slice of tuples that are references to LogRecord and InstrumentationScope. BatchLogProcessor already has a vec of owned LogRecord and InstrumentationScope. This PR is an attempt to reuse that vec.

Changes

  • Add a new constructor for LogBatch which accepts a shared reference to a slice of boxed tuple of owned LogRecord and InstrumentationScope.
  • No changes to the public API

Merge requirement checklist

  • CONTRIBUTING guidelines followed
  • Unit tests added/updated (if applicable)
  • Appropriate CHANGELOG.md files updated for non-trivial, user-facing changes
  • Changes in public API reviewed (if applicable)

@utpilla utpilla requested a review from a team as a code owner December 30, 2024 22:24
Copy link

codecov bot commented Dec 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 77.8%. Comparing base (9a8ad95) to head (94c854a).
Report is 1 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #2488   +/-   ##
=====================================
  Coverage   77.8%   77.8%           
=====================================
  Files        123     123           
  Lines      22867   22887   +20     
=====================================
+ Hits       17804   17824   +20     
  Misses      5063    5063           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@cijothomas cijothomas left a comment

Choose a reason for hiding this comment

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

Okay to special case to let BatchProcessor avoid alloc. Given no public api change, lets merge.

@cijothomas cijothomas merged commit 56e7fae into open-telemetry:main Dec 31, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants