Skip to content
This repository was archived by the owner on Apr 1, 2025. It is now read-only.

Unregistering depleted exponential decay/EWMA counters #283

Open
davidstrauss opened this issue Mar 17, 2021 · 0 comments
Open

Unregistering depleted exponential decay/EWMA counters #283

davidstrauss opened this issue Mar 17, 2021 · 0 comments

Comments

@davidstrauss
Copy link

davidstrauss commented Mar 17, 2021

I'm working on a system that may have a very large number of ExpDecaySample/EWMA counters, but most will quickly go to zero. That is, I plan to increment a large breadth of them, but most will decay to zero fairly quickly. I'd like to avoid having them pile up, especially since I can lazily reinitialize them.

One thing I'm looking at is using Each on a registry to Unregister decaying counters that have hit zero. I worry this is unnecessarily aggressive, though, as there's little harm in keeping around counters that have hit zero other than the goal of "garbage collection" for them. Also, I'm not sure if it's safe to unregister a metric that is currently passed to me via Each. Unlike for Register and GetOrRegisterCounter, I don't see any notes in the docs about thread safety (or other expectations).

Alternatively, I'm curious about options for discarding counters using an LRU/LFU when under memory pressure (or hitting other defined limits). I'm not particularly worried about empty counters taking space until the space becomes a problem.

@davidstrauss davidstrauss changed the title Unregistering depleted exponential decay counters Unregistering depleted exponential decay/EWMA counters Mar 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant