Class HdrHistogram
java.lang.Object
io.confluent.kafka.replication.push.metrics.HdrHistogram
A wrapper on top of the HdrHistogram API. It handles writing to the histogram by delegating
to an internal ValueRecorder implementation, and reading from the histogram by
efficiently implementing the retrieval of up-to-date histogram data (the exact implementation of
these varies depending on the HdrHistogram.ThreadSafetyMode with which the provider is initialized).
Note that all APIs expect a timestamp which is used by the histogram to discard decaying data and determine when the snapshot from which the histogram metrics are calculated should be refreshed.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDescribes the desired thread safety guarantees of the internally maintained HdrHistogramValueRecorderimplementation. -
Constructor Summary
ConstructorsConstructorDescriptionHdrHistogram(long maxSnapshotAgeMs, HdrHistogram.ThreadSafetyMode mode, long highestTrackableValue, int numberOfSignificantValueDigits) HdrHistogram(HdrHistogram.ThreadSafetyMode mode, long highestTrackableValue, int numberOfSignificantValueDigits) -
Method Summary
Modifier and TypeMethodDescriptionlongcount(long now) longmax(long now) doublemean(long now) doublemeasurePercentile(long now, double percentile) Reads percentile data from the histogram.longmin(long now) voidrecord(long value) Writes to the histogram.doublestdDeviation(long now)
-
Constructor Details
-
HdrHistogram
public HdrHistogram(HdrHistogram.ThreadSafetyMode mode, long highestTrackableValue, int numberOfSignificantValueDigits) -
HdrHistogram
public HdrHistogram(long maxSnapshotAgeMs, HdrHistogram.ThreadSafetyMode mode, long highestTrackableValue, int numberOfSignificantValueDigits)
-
-
Method Details
-
record
public void record(long value) Writes to the histogram. Will throwArrayIndexOutOfBoundsExceptionif the histogram's highestTrackableValue is lower than the value being recorded.- Parameters:
value- The value to be recorded. Cannot be negative.
-
count
public long count(long now) - Parameters:
now- An externally provided timestamp expected to be in milliseconds.- Returns:
- The total number of updates recorded by the histogram, i.e. the number of times
record(long)has been called.
-
max
public long max(long now) - Parameters:
now- An externally provided timestamp expected to be in milliseconds.- Returns:
- The maximum value recorded by the histogram.
-
mean
public double mean(long now) - Parameters:
now- An externally provided timestamp expected to be in milliseconds.- Returns:
- The mean/average of all the values recorded by the histogram.
-
min
public long min(long now) - Parameters:
now- An externally provided timestamp expected to be in milliseconds.- Returns:
- The minimum value recorded by the histogram.
-
stdDeviation
public double stdDeviation(long now) - Parameters:
now- An externally provided timestamp expected to be in milliseconds.- Returns:
- The population standard deviation of all the values recorded by the histogram.
-
measurePercentile
public double measurePercentile(long now, double percentile) Reads percentile data from the histogram.- Parameters:
now- An externally provided timestamp expected to be in milliseconds.percentile- The percentile for which a value is going to be retrieved. Expected to be between 0.0 and 100.0.- Returns:
- The histogram value for the given percentile.
-