public class Rate extends java.lang.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 | Class and Description |
---|---|
static class |
Rate.SampledTotal
Deprecated.
since 2.4 Use
WindowedSum instead. |
Modifier and Type | Field and Description |
---|---|
protected SampledStat |
stat |
protected java.util.concurrent.TimeUnit |
unit |
Constructor and Description |
---|
Rate() |
Rate(SampledStat stat) |
Rate(java.util.concurrent.TimeUnit unit) |
Rate(java.util.concurrent.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
|
java.lang.String |
unitName() |
long |
windowSize(MetricConfig config,
long now) |
protected final java.util.concurrent.TimeUnit unit
protected final SampledStat stat
public Rate()
public Rate(java.util.concurrent.TimeUnit unit)
public Rate(SampledStat stat)
public Rate(java.util.concurrent.TimeUnit unit, SampledStat stat)
public java.lang.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)