Skip to content

Expose TrackConsumersPool memory consumer metrics programmatically #21146

@bert-beyondloops

Description

@bert-beyondloops

Is your feature request related to a problem or challenge?

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).

Describe the solution you'd like

Add 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.

Describe alternatives you've considered

No response

Additional context

This is useful for embedding DataFusion in systems that want to expose per-operator memory metrics through their own observability pipelines (e.g., Prometheus, OpenTelemetry or custom dashboards).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions