feat(memory_pool): add TrackConsumersPool::metrics() to expose cons…#21147
Open
bert-beyondloops wants to merge 1 commit intoapache:mainfrom
Open
feat(memory_pool): add TrackConsumersPool::metrics() to expose cons…#21147bert-beyondloops wants to merge 1 commit intoapache:mainfrom
TrackConsumersPool::metrics() to expose cons…#21147bert-beyondloops wants to merge 1 commit intoapache:mainfrom
Conversation
ac10b8f to
37cf8e4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Rationale for this change
There is currently no way to programmatically inspect the memory consumption of individual consumers tracked by TrackConsumersPool. The only available method, report_top(), returns a formatted string intended for human-readable output, making it unsuitable for programmatic use (e.g., metrics collection, monitoring, or custom reporting).
What changes are included in this PR?
Added a metrics() method to TrackConsumersPool that returns a Vec — a snapshot of all currently tracked consumers. Each MemoryConsumerMetrics entry exposes:
name — the consumer's name
can_spill — whether the consumer supports spilling to disk
reserved — current bytes reserved
peak — peak bytes reserved
This allows callers to inspect memory usage programmatically without parsing formatted strings.
Are these changes tested?
Yes. A dedicated unit test test_track_consumers_pool_metrics was added in pool.rs that verifies:
Are there any user-facing changes?
No