Class ExponentialHistogramUtils
java.lang.Object
org.elasticsearch.exponentialhistogram.ExponentialHistogramUtils
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic OptionalDoubleestimateMax(ZeroBucket zeroBucket, ExponentialHistogram.Buckets negativeBuckets, ExponentialHistogram.Buckets positiveBuckets) Estimates the maximum value of the histogram based on the populated buckets.static OptionalDoubleestimateMin(ZeroBucket zeroBucket, ExponentialHistogram.Buckets negativeBuckets, ExponentialHistogram.Buckets positiveBuckets) Estimates the minimum value of the histogram based on the populated buckets.static doubleestimateSum(BucketIterator negativeBuckets, BucketIterator positiveBuckets) Estimates the sum of all values of a histogram just based on the populated buckets.removeMergeNoise(ExponentialHistogram first, ExponentialHistogram second) 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.
-
Constructor Details
-
ExponentialHistogramUtils
public ExponentialHistogramUtils()
-
-
Method Details
-
estimateSum
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 histogrampositiveBuckets- 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 histogramnegativeBuckets- the negative buckets of the histogrampositiveBuckets- 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 histogramnegativeBuckets- the negative buckets of the histogrampositiveBuckets- the positive buckets of the histogram- Returns:
- the estimated minimum
-
removeMergeNoise
public static ExponentialHistogramUtils.HistogramPair removeMergeNoise(ExponentialHistogram first, ExponentialHistogram second) 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 histogramsecond- the second histogram- Returns:
- the adjusted histograms
-