Class MetricsCollector.HistogramSnapshot
java.lang.Object
com.soklet.MetricsCollector.HistogramSnapshot
- Enclosing interface:
MetricsCollector
Immutable snapshot of a
MetricsCollector.Histogram.
Bucket counts are cumulative. Boundaries are inclusive upper bounds, and the final
boundary is Long.MAX_VALUE to represent the overflow bucket. Units are the same
as values passed to MetricsCollector.Histogram.record(long).
- Author:
- Mark Allen
-
Constructor Summary
ConstructorsConstructorDescriptionHistogramSnapshot(@NonNull long[] bucketBoundaries, @NonNull long[] bucketCumulativeCounts, long count, long sum, long min, long max) Creates an immutable histogram snapshot. -
Method Summary
Modifier and TypeMethodDescriptionlonggetBucketBoundary(int index) The inclusive upper bound for the bucket at the given index.intNumber of histogram buckets, including the overflow bucket.longgetBucketCumulativeCount(int index) The cumulative count for the bucket at the given index.longgetCount()Total number of recorded values.longgetMax()Largest recorded value, or 0 if no values were recorded.longgetMin()Smallest recorded value, or 0 if no values were recorded.longgetPercentile(double percentile) Returns an approximate percentile based on bucket boundaries.longgetSum()Sum of all recorded values.toString()
-
Constructor Details
-
HistogramSnapshot
public HistogramSnapshot(@NonNull long[] bucketBoundaries, @NonNull long[] bucketCumulativeCounts, long count, long sum, long min, long max) Creates an immutable histogram snapshot.- Parameters:
bucketBoundaries- inclusive upper bounds for buckets, including overflowbucketCumulativeCounts- cumulative counts for each bucketcount- total number of samples recordedsum- sum of all recorded valuesmin- smallest recorded value (or 0 if none)max- largest recorded value (or 0 if none)
-
-
Method Details
-
getBucketCount
Number of histogram buckets, including the overflow bucket.- Returns:
- the bucket count
-
getBucketBoundary
The inclusive upper bound for the bucket at the given index.- Parameters:
index- the bucket index- Returns:
- the bucket boundary
-
getBucketCumulativeCount
The cumulative count for the bucket at the given index.- Parameters:
index- the bucket index- Returns:
- the cumulative count
-
getCount
-
getSum
-
getMin
Smallest recorded value, or 0 if no values were recorded.- Returns:
- the minimum value
-
getMax
Largest recorded value, or 0 if no values were recorded.- Returns:
- the maximum value
-
getPercentile
Returns an approximate percentile based on bucket boundaries.- Parameters:
percentile- percentile between 0 and 100- Returns:
- the approximated percentile value
-
toString
-