Package com.linkedin.venice.stats
Class TehutiUtils.RatioStat
- java.lang.Object
-
- io.tehuti.metrics.stats.AsyncGauge
-
- com.linkedin.venice.stats.LambdaStat
-
- com.linkedin.venice.stats.TehutiUtils.RatioStat
-
- All Implemented Interfaces:
io.tehuti.metrics.Measurable
,io.tehuti.metrics.MeasurableStat
,io.tehuti.metrics.NamedMeasurableStat
,io.tehuti.metrics.Stat
- Enclosing class:
- TehutiUtils
public static class TehutiUtils.RatioStat extends LambdaStat
Generate a ratio stat that is based on two arbitraryRate
. It calculates the proportion of one Stat over the sum of two Stats. This method is mostly used to calculate the bad request ratio (bad / (good + bad)) UseRate
instead ofSampledStat
to capture the event rate, so that the result won't get impacted by the un-aligned windows introduced bySampledStat
. More background:SampledStat
is not maintaining sliding windows based on absolute time, and the new window creation is triggered by new event, considering the event for different metrics could happen at different rate/time, the sliding-windows being used by different metrics will be different. In this case, if we want to emit the ratio of two metrics, the result won't reflect the actual data since the nominator could use the window starting from time: t1, and the denominator could use the window starting from time: t2. By usingRate
, the ratio metric will be more reasonable since it doesn't depend on the actual window size/starting time, but the average event frequency. It is still not perfect, since both nominator and denominator metrics could still use different window size/starting time. The ultimate solution should be to use the consistent windowing (based on absolute time) across all the metrics.
-
-
Constructor Summary
Constructors Constructor Description RatioStat(io.tehuti.metrics.stats.Rate one, io.tehuti.metrics.stats.Rate two, java.lang.String metricName)
-