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
Generate a ratio stat that is based on two arbitrary
Rate
. 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))
Use Rate
instead of SampledStat
to capture the event rate, so that the result
won't get impacted by the un-aligned windows introduced by SampledStat
.
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 using Rate
, 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.-
Nested Class Summary
Nested classes/interfaces inherited from class io.tehuti.metrics.stats.AsyncGauge
io.tehuti.metrics.stats.AsyncGauge.AsyncGaugeExecutor
-
Field Summary
Fields inherited from class io.tehuti.metrics.stats.AsyncGauge
DEFAULT_ASYNC_GAUGE_EXECUTOR
-
Constructor Summary
-
Method Summary
Methods inherited from class io.tehuti.metrics.stats.AsyncGauge
getStatName, measure, record
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.tehuti.metrics.Measurable
measureWithExtraValue
-
Constructor Details
-
RatioStat
public RatioStat(io.tehuti.metrics.stats.Rate one, io.tehuti.metrics.stats.Rate two, String metricName)
-