Skip to content

[exporterhelper] Support mixed sizer types in persistent queue without draining #13246

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

malus2077
Copy link
Contributor

@malus2077 malus2077 commented Jun 22, 2025

Summary

Implements non-blocking queue handling for sizer configuration changes by embedding item size information directly into queue items, eliminating the need to drain queues when switching between different sizer types.

Problem Statement

Solution

  • Embed itemSize in each queue item using new QueueItem protobuf message
  • Consolidate metadata storage from multiple keys to single qmv0 key
  • Implement backward-compatible migration from legacy format
  • Remove obsolete SizerType tracking

Breaking Changes

None - Fully backward compatible with automatic migration

Testing

  • Mixed sizer type handling test
  • Legacy format migration test
  • Corrupted data recovery test
  • Concurrent access test

Performance Impact

  • Minimal: +8 bytes per queue item for size storage
  • Improved: Reduced storage operations via metadata consolidation
  • Tradeoff: Slight serialization overhead vs operational flexibility

@malus2077 malus2077 requested review from bogdandrutu, dmitryax and a team as code owners June 22, 2025 15:07
Copy link

codecov bot commented Jun 22, 2025

Codecov Report

Attention: Patch coverage is 77.92208% with 34 lines in your changes missing coverage. Please review.

Project coverage is 91.45%. Comparing base (35668a1) to head (5dcf084).

Files with missing lines Patch % Lines
.../exporterhelper/internal/queue/persistent_queue.go 77.92% 21 Missing and 13 partials ⚠️

❌ Your patch check has failed because the patch coverage (77.92%) is below the target coverage (95.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #13246      +/-   ##
==========================================
- Coverage   91.57%   91.45%   -0.12%     
==========================================
  Files         522      521       -1     
  Lines       29089    29155      +66     
==========================================
+ Hits        26639    26665      +26     
- Misses       1933     1959      +26     
- Partials      517      531      +14     

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@malus2077 malus2077 changed the title [refactor] Implement non-blocking queue handling for sizer changes [exporterhelper] Support mixed sizer types in persistent queue without draining Jun 23, 2025
This refactoring eliminates sizer type dependencies in persistent queues,
enabling seamless mixed sizer usage without requiring queue draining.

Key changes:
- Embed itemSize in each QueueItem for mixed sizer support
- Consolidate metadata storage with single protobuf structure (qmv0 key)
- Add backward compatibility with automatic legacy format migration
- Remove obsolete SizerType enum and conversion logic
- Update persistent queue logic for new metadata format
- Add comprehensive migration tests and update existing tests
- Add changelog entry for enhancement tracking

Fixes open-telemetry#12890
Related to: open-telemetry#13126
@malus2077 malus2077 force-pushed the sizer-drain-optimization-12890 branch from abf1753 to 70024af Compare June 23, 2025 06:24
Comment on lines +22 to +27
// QueueItem represents a single item stored in the persistent queue.
message QueueItem {
// Size of the item according to the sizer that was active when enqueued
int64 item_size = 1;
// The marshaled data of the item.
bytes item_data = 2;
Copy link
Member

Choose a reason for hiding this comment

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

We did a lot of work to avoid multiple copies and allocations of the marshalled bytes in @dmitryax pdatax work, and here we will just re-allocate and copy the whole data.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should the current PR be closed?

Copy link
Member

@bogdandrutu bogdandrutu left a comment

Choose a reason for hiding this comment

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

I provided comment in the other PR, please focus on adopting what we design first.

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