Class ExponentialHistogramUtils

java.lang.Object
org.elasticsearch.exponentialhistogram.ExponentialHistogramUtils

public class ExponentialHistogramUtils extends Object
  • Constructor Details

    • ExponentialHistogramUtils

      public ExponentialHistogramUtils()
  • Method Details

    • estimateSum

      public static double estimateSum(BucketIterator negativeBuckets, BucketIterator positiveBuckets)
      Estimates the sum of all values of a histogram just based on the populated buckets. Will never return NaN, but might return +/-Infinity if the histogram is too big.
      Parameters:
      negativeBuckets - the negative buckets of the histogram
      positiveBuckets - the positive buckets of the histogram
      Returns:
      the estimated sum of all values in the histogram, guaranteed to be zero if there are no buckets.
    • estimateMin

      public static OptionalDouble estimateMin(ZeroBucket zeroBucket, ExponentialHistogram.Buckets negativeBuckets, ExponentialHistogram.Buckets positiveBuckets)
      Estimates the minimum value of the histogram based on the populated buckets. The returned value is guaranteed to be less than or equal to the exact minimum value of the histogram values. If the histogram is empty, an empty Optional is returned.

      Note that this method can return +-Infinity if the histogram bucket boundaries are not representable in a double.

      Parameters:
      zeroBucket - the zero bucket of the histogram
      negativeBuckets - the negative buckets of the histogram
      positiveBuckets - the positive buckets of the histogram
      Returns:
      the estimated minimum
    • estimateMax

      public static OptionalDouble estimateMax(ZeroBucket zeroBucket, ExponentialHistogram.Buckets negativeBuckets, ExponentialHistogram.Buckets positiveBuckets)
      Estimates the maximum value of the histogram based on the populated buckets. The returned value is guaranteed to be greater than or equal to the exact maximum value of the histogram values. If the histogram is empty, an empty Optional is returned.

      Note that this method can return +-Infinity if the histogram bucket boundaries are not representable in a double.

      Parameters:
      zeroBucket - the zero bucket of the histogram
      negativeBuckets - the negative buckets of the histogram
      positiveBuckets - the positive buckets of the histogram
      Returns:
      the estimated minimum
    • removeMergeNoise

      Makes sure that if both histograms were generated by merging the same set of histograms, they are equal independent of the order in which the merge occurred. This utility is intended for usage in tests.
      Parameters:
      first - the first histogram
      second - the second histogram
      Returns:
      the adjusted histograms