Class Rate
- java.lang.Object
-
- org.apache.kafka.common.metrics.stats.Rate
-
- All Implemented Interfaces:
Measurable
,MeasurableStat
,MetricValueProvider<Double>
,Stat
- Direct Known Subclasses:
SimpleRate
public class Rate extends Object implements MeasurableStat
The rate of the given quantity. By default this is the total observed over a set of samples from a sampled statistic divided by the elapsed time over the sample windows. AlternativeSampledStat
implementations can be provided, however, to record the rate of occurrences (e.g. the count of values measured over the time interval) or other such values.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Rate.SampledTotal
Deprecated.since 2.4 UseWindowedSum
instead.
-
Field Summary
Fields Modifier and Type Field Description protected SampledStat
stat
protected TimeUnit
unit
-
Constructor Summary
Constructors Constructor Description Rate()
Rate(TimeUnit unit)
Rate(TimeUnit unit, SampledStat stat)
Rate(SampledStat stat)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
measure(MetricConfig config, long now)
Measure this quantity and return the result as a doublevoid
record(MetricConfig config, double value, long timeMs)
Record the given valueString
unitName()
long
windowSize(MetricConfig config, long now)
-
-
-
Field Detail
-
unit
protected final TimeUnit unit
-
stat
protected final SampledStat stat
-
-
Constructor Detail
-
Rate
public Rate()
-
Rate
public Rate(TimeUnit unit)
-
Rate
public Rate(SampledStat stat)
-
Rate
public Rate(TimeUnit unit, SampledStat stat)
-
-
Method Detail
-
unitName
public String unitName()
-
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
-
windowSize
public long windowSize(MetricConfig config, long now)
-
-