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
I'm trying to create components that report metrics through holding an e.g. IntCounter generated from a registered IntCounterVec. I would like the set of labels attached to each component to be removed when the component is dropped, to avoid reporting the last value over and over again.
Currently this is very convoluted to achieve, since it requires holding a clone of the MetricVec, and the inner type of that MetricVec cannot be specified because it is behind a private submodule of the crate.
What is the best way to achieve this? e.g. to do something in impl Drop that will remove the set of labels for a counter, but will keep other labels intact?
The text was updated successfully, but these errors were encountered:
Would exposing MetricVec::reset() on the gauges help to at least provide manual GC for metric values? Was misreading the code, seems it's already exposed. I suppose you can remove the values manually when you finish a request? Would need a reference to the underlying MetricVec but seems doable? The main issue I foresee is that you probably want a time delay due if you're not pushing metrics for the scraper to pick up the values.
I'm trying to create components that report metrics through holding an e.g.
IntCounter
generated from a registeredIntCounterVec
. I would like the set of labels attached to each component to be removed when the component is dropped, to avoid reporting the last value over and over again.Currently this is very convoluted to achieve, since it requires holding a clone of the
MetricVec
, and the inner type of thatMetricVec
cannot be specified because it is behind a private submodule of the crate.What is the best way to achieve this? e.g. to do something in
impl Drop
that will remove the set of labels for a counter, but will keep other labels intact?The text was updated successfully, but these errors were encountered: