You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature request - public registry._names_to_collectors access #1071
Now we are working on Prometheus support in FastStream and faced with a problem. Shared registry between different middlewares leads to MetricsContainer duplication. So, we would like to have a public API to chech registry for already registered objects.
Can you please provide public access to this property some way?
Is it not sufficient to call collect() and see what all is returned to get a list of all metrics?
My concern with adding that function is that not all registries are instances of CollectorRegistry, some applications may use their own implementation. Not to mention things like custom collectors.
Well, seems like we can't create any metric with custom CollectorRegistry implementation - all registry options are Optional[CollectorRegistry] = REGISTRY type
Activity
Lancetnik commentedon Nov 19, 2024
Related to - ag2ai/faststream#1921
csmarchbanks commentedon Nov 19, 2024
Is it not sufficient to call
collect()and see what all is returned to get a list of all metrics?My concern with adding that function is that not all registries are instances of
CollectorRegistry, some applications may use their own implementation. Not to mention things like custom collectors.Lancetnik commentedon Nov 20, 2024
To clarify - we just want to avoid double metrics registration
https://github.com/airtai/faststream/blob/main/faststream/prometheus/container.py#L40
Lancetnik commentedon Nov 20, 2024
Well, seems like we can't create any metric with custom
CollectorRegistryimplementation - allregistryoptions areOptional[CollectorRegistry] = REGISTRYtypehttps://github.com/prometheus/client_python/blob/master/prometheus_client/metrics.py#L132
So, the initial point about
CollectorRegistryproperty still actualdraincoder commentedon Nov 20, 2024
collect()returns only non-zero metrics and resets their state. In addition, we need to get an instance of the metric by the name of the metric.