prometheus_client_php icon indicating copy to clipboard operation
prometheus_client_php copied to clipboard

\Prometheus\CollectorRegistry::getMetricFamilySamples uses a large amount of memory

Open skyellin opened this issue 1 year ago • 0 comments

\Prometheus\CollectorRegistry::getMetricFamilySamples, and the functions it uses, needs to store the entire output in memory. This can grow quite large for applications with a lot of metrics and high cardinality. It seems that it would be possible to avoid keeping all the output in memory, by having \Prometheus\CollectorRegistry::getMetricFamilySamples (and its dependecies) return a generator rather than an array.

skyellin avatar Dec 15 '23 13:12 skyellin