Class SampledStat
- java.lang.Object
-
- org.apache.kafka.common.metrics.stats.SampledStat
-
- All Implemented Interfaces:
Measurable
,MeasurableStat
,MetricValueProvider<Double>
,Stat
- Direct Known Subclasses:
Avg
,Frequencies
,Max
,Min
,Percentiles
,WindowedSum
public abstract class SampledStat extends Object implements MeasurableStat
A SampledStat records a single scalar value measured over one or more samples. Each sample is recorded over a configurable window. The window can be defined by number of events or elapsed time (or both, if both are given the window is complete when either the event count or elapsed time criterion is met).All the samples are combined to produce the measurement. When a window is complete the oldest sample is cleared and recycled to begin recording the next sample. Subclasses of this class define different statistics measured using this basic pattern.
-
-
Constructor Summary
Constructors Constructor Description SampledStat(double initialValue)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract double
combine(List<org.apache.kafka.common.metrics.stats.SampledStat.Sample> samples, MetricConfig config, long now)
org.apache.kafka.common.metrics.stats.SampledStat.Sample
current(long timeMs)
double
measure(MetricConfig config, long now)
Measure this quantity and return the result as a doubleorg.apache.kafka.common.metrics.stats.SampledStat.Sample
oldest(long now)
void
record(MetricConfig config, double value, long timeMs)
Record the given valueString
toString()
-
-
-
Method Detail
-
record
public void record(MetricConfig config, double value, long timeMs)
Description copied from interface:Stat
Record the given value
-
measure
public double measure(MetricConfig config, long now)
Description copied from interface:Measurable
Measure this quantity and return the result as a double- Specified by:
measure
in interfaceMeasurable
- Parameters:
config
- The configuration for this metricnow
- The POSIX time in milliseconds the measurement is being taken- Returns:
- The measured value
-
current
public org.apache.kafka.common.metrics.stats.SampledStat.Sample current(long timeMs)
-
oldest
public org.apache.kafka.common.metrics.stats.SampledStat.Sample oldest(long now)
-
combine
public abstract double combine(List<org.apache.kafka.common.metrics.stats.SampledStat.Sample> samples, MetricConfig config, long now)
-
-