public class DecayingEstimatedHistogramReservoir
extends java.lang.Object
implements com.codahale.metrics.Reservoir
Snapshot.getValues()
which will return values
from the reservoir without decay. This makes it possible for the caller to maintain precise deltas in an interval of
its choise.
The bucket size starts at 1 and grows by 1.2 each time (rounding and removing duplicates). It goes from 1 to around
18T by default (creating 164+1 buckets), which will give a timing resolution from microseconds to roughly 210 days,
with less precision as the numbers get larger.
The series of values to which the counts in `decayingBuckets` correspond:
1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 17, 20, 24, 29, 35, 42, 50, 60, 72 etc.
Thus, a `decayingBuckets` of [0, 0, 1, 10] would mean we had seen 1 value of 3 and 10 values of 4.
Each bucket represents values from (previous bucket offset, current offset].
[1]: http://dimacs.rutgers.edu/~graham/pubs/papers/fwddecay.pdf
[2]: https://en.wikipedia.org/wiki/Half-life
[3]: https://github.com/dropwizard/metrics/blob/v3.1.2/metrics-core/src/main/java/com/codahale/metrics/ExponentiallyDecayingReservoir.javaModifier and Type | Field and Description |
---|---|
static int |
DEFAULT_BUCKET_COUNT
The default number of decayingBuckets.
|
static long[] |
DEFAULT_WITH_ZERO_BUCKET_OFFSETS |
static long[] |
DEFAULT_WITHOUT_ZERO_BUCKET_OFFSETS |
static boolean |
DEFAULT_ZERO_CONSIDERATION |
static long |
HALF_TIME_IN_S |
static long |
LANDMARK_RESET_INTERVAL_IN_MS |
static double |
MEAN_LIFETIME_IN_S |
Constructor and Description |
---|
DecayingEstimatedHistogramReservoir()
Construct a decaying histogram with default number of buckets and without considering zeroes.
|
DecayingEstimatedHistogramReservoir(boolean considerZeroes)
Construct a decaying histogram with default number of buckets.
|
DecayingEstimatedHistogramReservoir(boolean considerZeroes,
int bucketCount)
Construct a decaying histogram.
|
Modifier and Type | Method and Description |
---|---|
void |
clear() |
com.codahale.metrics.Snapshot |
getSnapshot()
Returns a snapshot of the decaying values in this reservoir.
|
int |
size()
Return the number of buckets where recorded values are stored.
|
void |
update(long value)
Increments the count of the bucket closest to n, rounding UP.
|
public static final int DEFAULT_BUCKET_COUNT
public static final boolean DEFAULT_ZERO_CONSIDERATION
public static final long[] DEFAULT_WITHOUT_ZERO_BUCKET_OFFSETS
public static final long[] DEFAULT_WITH_ZERO_BUCKET_OFFSETS
public static final long HALF_TIME_IN_S
public static final double MEAN_LIFETIME_IN_S
public static final long LANDMARK_RESET_INTERVAL_IN_MS
public DecayingEstimatedHistogramReservoir()
public DecayingEstimatedHistogramReservoir(boolean considerZeroes)
considerZeroes
- when true, 0-value measurements in a separate bucket, otherwise they will be collected in
same bucket as 1-value measurementspublic DecayingEstimatedHistogramReservoir(boolean considerZeroes, int bucketCount)
considerZeroes
- when true, 0-value measurements in a separate bucket, otherwise they will be collected in
same bucket as 1-value measurementsbucketCount
- number of buckets used to collect measured valuespublic void update(long value)
update
in interface com.codahale.metrics.Reservoir
value
- the data point to add to the histogrampublic int size()
Reservoir
interface.size
in interface com.codahale.metrics.Reservoir
public com.codahale.metrics.Snapshot getSnapshot()
getSnapshot
in interface com.codahale.metrics.Reservoir
public void clear()
Copyright © 2021 The Apache Software Foundation