public abstract class SampledStat extends Object implements MeasurableStat
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 and Description |
---|
SampledStat(double initialValue) |
Modifier and Type | Method and 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 double
|
org.apache.kafka.common.metrics.stats.SampledStat.Sample |
oldest(long now) |
void |
record(MetricConfig config,
double value,
long timeMs)
Record the given value
|
String |
toString() |
public void record(MetricConfig config, double value, long timeMs)
Stat
public double measure(MetricConfig config, long now)
Measurable
measure
in interface Measurable
config
- The configuration for this metricnow
- The POSIX time in milliseconds the measurement is being takenpublic org.apache.kafka.common.metrics.stats.SampledStat.Sample current(long timeMs)
public org.apache.kafka.common.metrics.stats.SampledStat.Sample oldest(long now)
public abstract double combine(List<org.apache.kafka.common.metrics.stats.SampledStat.Sample> samples, MetricConfig config, long now)