Class MetricsCollector.Histogram

java.lang.Object
com.soklet.MetricsCollector.Histogram
Enclosing interface:
MetricsCollector

@ThreadSafe public static final class MetricsCollector.Histogram extends Object
A thread-safe histogram with fixed bucket boundaries.

Negative values are ignored. Buckets use inclusive upper bounds, and snapshots include an overflow bucket represented by a MetricsCollector.HistogramSnapshot.getBucketBoundary(int) of Long.MAX_VALUE.

Author:
Mark Allen
  • Constructor Details

    • Histogram

      public Histogram(@NonNull long[] bucketBoundaries)
      Creates a histogram with the provided bucket boundaries.
      Parameters:
      bucketBoundaries - inclusive upper bounds for buckets
  • Method Details

    • record

      public void record(long value)
      Records a value into the histogram.
      Parameters:
      value - the value to record
    • snapshot

      Captures an immutable snapshot of the histogram.
      Returns:
      the histogram snapshot
    • reset

      public void reset()
      Resets all counts and min/max values.