-
Notifications
You must be signed in to change notification settings - Fork 455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to reuse the PrometheusLayer with the same registry #4854
Comments
I think we can just remove this |
Thanks, I think this can be addressed in a separate PR. Would you like to help with that? |
Oh, I just see why it's impossible because we need that register call to return the handle. If there is an error we won't be able to get the handle. We need to go upstream for this. |
We need a way to get the registered metric |
Thank you for notification. We will switch to upstream implementation during next upgrade |
As mentioned in GreptimeTeam/greptimedb#4277 (comment), the
PrometheusLayer
will create a newPrometheusMetrics
each time we register it to anOperatorBuilder
.opendal/core/src/layers/prometheus.rs
Lines 154 to 163 in 174bda5
However, the registry panics if we create
PrometheusMetrics
with the same registry more than once.opendal/core/src/layers/prometheus.rs
Lines 181 to 198 in 174bda5
So users are unable to create multiple operators with the same layer that collects metrics to the default global registry of
rust-prometheus
.One approach to work around this without breaking change is to allow users to set the
PrometheusMetrics
.If users set the
metrics
explicitly, then the layer uses the providedmetrics
. So we can pre-build thePrometheusMetrics
and reuse it without constructing a new one each time.The text was updated successfully, but these errors were encountered: