Class ExponentialHistogramBuilder

java.lang.Object
org.elasticsearch.exponentialhistogram.ExponentialHistogramBuilder
All Implemented Interfaces:
Closeable, AutoCloseable, Releasable

public class ExponentialHistogramBuilder extends Object implements Releasable
A builder for building a ReleasableExponentialHistogram directly from buckets.
  • Method Details

    • estimatedBucketCount

      public ExponentialHistogramBuilder estimatedBucketCount(int totalBuckets)
      If known, sets the estimated total number of buckets to minimize unnecessary allocations. Only has an effect if invoked before the first call to setPositiveBucket(long, long) and setNegativeBucket(long, long).
      Parameters:
      totalBuckets - the total number of buckets expected to be added
      Returns:
      the builder
    • scale

      public ExponentialHistogramBuilder scale(int scale)
    • zeroBucket

      public ExponentialHistogramBuilder zeroBucket(ZeroBucket zeroBucket)
    • sum

      public ExponentialHistogramBuilder sum(double sum)
      Sets the sum of the histogram values. If not set, the sum will be estimated from the buckets.
      Parameters:
      sum - the sum value
      Returns:
      the builder
    • min

      public ExponentialHistogramBuilder min(double min)
      Sets the min value of the histogram values. If not set, the min will be estimated from the buckets.
      Parameters:
      min - the min value
      Returns:
      the builder
    • max

      public ExponentialHistogramBuilder max(double max)
      Sets the max value of the histogram values. If not set, the max will be estimated from the buckets.
      Parameters:
      max - the max value
      Returns:
      the builder
    • setPositiveBucket

      public ExponentialHistogramBuilder setPositiveBucket(long index, long count)
      Sets the given bucket of the positive buckets. If the bucket already exists, it will be replaced. Buckets may be set in arbitrary order. However, for best performance and minimal allocations, buckets should be set in order of increasing index and all negative buckets should be set before positive buckets.
      Parameters:
      index - the index of the bucket
      count - the count of the bucket, must be at least 1
      Returns:
      the builder
    • setNegativeBucket

      public ExponentialHistogramBuilder setNegativeBucket(long index, long count)
      Sets the given bucket of the negative buckets. If the bucket already exists, it will be replaced. Buckets may be set in arbitrary order. However, for best performance and minimal allocations, buckets should be set in order of increasing index and all negative buckets should be set before positive buckets.
      Parameters:
      index - the index of the bucket
      count - the count of the bucket, must be at least 1
      Returns:
      the builder
    • build

    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface Releasable