Class Histogram.BucketBounds

  • Enclosing class:
    Histogram

    public abstract static class Histogram.BucketBounds
    extends java.lang.Object
    Defines the bounds for histogram buckets.

    Use the provided static factory methods to create new instances of Histogram.BucketBounds.

    • Method Detail

      • getBounds

        public abstract java.util.List<java.lang.Double> getBounds()
      • exponential

        public static Histogram.BucketBounds exponential​(double scale,
                                                         double growthFactor,
                                                         int numBoundedBuckets,
                                                         Histogram.BoundsInclusivity boundsInclusivity)
        Static factory method for defining bounds of exponential histograms and calculating bounds based on the parameters.

        For BoundsInclusivity.LOWER_BOUND_INCLUSIVE_UPPER_BOUND_EXCLUSIVE, the list that the HistogramCombineFn combiner returns contains the number of elements in the following buckets:

         0-th: (-inf, scale) - underflow bucket
         1-st: [scale, scale * growthFactor)
         2-nd: [scale * growthFactor, scale * growthFactor^2)
         ...
         i-th: [scale * growthFactor^(i-1), scale * growthFactor^i)
         ...
         numBoundedBuckets: [scale * growthFactor^(numBoundedBuckets-1), scale *
         growthFactor^numBoundedBuckets)
         numBoundedBuckets + 1: [scale * growthFactor^numBoundedBuckets), +inf) - overflow bucket.
         

        For BoundsInclusivity.LOWER_BOUND_EXCLUSIVE_UPPER_BOUND_INCLUSIVE, the list that the HistogramCombineFn combiner returns contains the number of elements in the following buckets:

         0-th: (-inf, scale] - underflow bucket
         1-st: (scale, scale * growthFactor]
         2-nd: (scale * growthFactor, scale * growthFactor^2]
         ...
         i-th: (scale * growthFactor^(i-1), scale * growthFactor^i]
         ...
         numBoundedBuckets: (scale * growthFactor^(numBoundedBuckets-1), scale *
         growthFactor^numBoundedBuckets]
         numBoundedBuckets + 1: (scale * growthFactor^numBoundedBuckets), +inf) - overflow bucket.
         
        Parameters:
        scale - the value of the lower bound for the first bounded bucket.
        growthFactor - value by which the bucket bounds are exponentially increased.
        numBoundedBuckets - integer determining the total number of bounded buckets within the histogram.
        boundsInclusivity - enum value which defines if lower or upper bounds are inclusive/exclusive.
      • linear

        public static Histogram.BucketBounds linear​(double offset,
                                                    double width,
                                                    int numBoundedBuckets,
                                                    Histogram.BoundsInclusivity boundsInclusivity)
        Static factory method for defining bounds of linear histogram and calculating bounds based on the parameters.
        Parameters:
        offset - value of the lower bound for the first bounded bucket.
        width - bucket width.
        numBoundedBuckets - integer determining the total number of bounded buckets within the histogram.
        boundsInclusivity - enum value which defines if lower or upper bounds are inclusive/exclusive.
      • explicit

        public static Histogram.BucketBounds explicit​(java.util.List<java.lang.Double> bounds,
                                                      Histogram.BoundsInclusivity boundsInclusivity)
        Static factory method for defining bounds of explicit histogram.
        Parameters:
        bounds - array of explicit bounds of the buckets.
        boundsInclusivity - enum value which defines if lower or upper bounds are inclusive/exclusive.