public class Rate extends Object implements MeasurableStat
SampledStat
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.Modifier and Type | Field and Description |
---|---|
protected SampledStat |
stat |
protected TimeUnit |
unit |
Constructor and Description |
---|
Rate() |
Rate(SampledStat stat) |
Rate(TimeUnit unit) |
Rate(TimeUnit unit,
SampledStat stat) |
Modifier and Type | Method and Description |
---|---|
double |
measure(MetricConfig config,
long now)
Measure this quantity and return the result as a double
|
void |
record(MetricConfig config,
double value,
long timeMs)
Record the given value
|
String |
toString() |
String |
unitName() |
long |
windowSize(MetricConfig config,
long now) |
protected final TimeUnit unit
protected final SampledStat stat
public Rate()
public Rate(TimeUnit unit)
public Rate(SampledStat stat)
public Rate(TimeUnit unit, SampledStat stat)
public String unitName()
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 long windowSize(MetricConfig config, long now)