I see there is the
CachedGauge in the DropWizard Metrics (formerly Coda Hale Metrics) lib. I'm wondering why anyone would ever use this?!?
My understanding of the value of a metric is that it is real-time, accurate and relevant. If a metric is reporting a stale/cached value, of what purpose could it possibly serve?
Best How To :
Quoting the same link you added:
A cached gauge allows for a more efficient reporting of values which are expensive to calculate
What if your metric takes around two seconds seconds to calculate, or even minutes? Would you calculate every time the user request the data? Makes sense to store on a cache.
Such metric isn't what I would call real time because updating itself takes more time than rendering the information for the user. The metric is outdated already when it finishes it's calculation.