Skip to content

Upper Bound Problem of _metrics_to_export #874

@CunjunWang

Description

@CunjunWang

Is your feature request related to a problem?
Yes. Currently the Python Prometheus Exporter implementation uses a double ended queue called _metrics_to_export to work as an intermediate storage. export() function in the PrometheusMetricsExporter class add metrics data entry to the queue, and collect() function pulls data from the queue. What if the controller keeps adding metric data to the queue but no one is pulling from it? It seems that there is not a mechanism to handle this case. Do we need an upper bound on the number of metrics data in the queue?

Describe the solution you'd like
Use a memory upper bound, the collection’s size is limited. When the collection is full, discard the new incoming data or replace the data at the front.

Describe alternatives you've considered
Use a time-based upper bound. Every metric data entry carries a timestamp when they are added into the collection, and set a timeout. If the entry is not pulled by the user within the timeout, it expires and it is discarded.

Additional context
Python Prometheus Exporter implementation

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions