tikv / rust-prometheus

Prometheus instrumentation library for Rust applications
Apache License 2.0
1.04k stars 182 forks source link

Can the collector be mutable? #478

Closed zengxilong closed 1 year ago

zengxilong commented 1 year ago

Is your feature request related to a problem? Please describe.

My collector implementation includes a global map to record the indicators that have been collected, so that conflicting indicators can be eliminated when the collect function is executed. But the self parameter of the collect function is immutable, I cannot change the map.

image

Describe the solution you'd like Maybe you can change &self to &mut self? I don't know if this will have a big impact on the whole project.

Describe alternatives you've considered

Additional context