Class ExplicitBucketHistogramUtils

java.lang.Object
io.opentelemetry.sdk.metrics.internal.aggregator.ExplicitBucketHistogramUtils

public final class ExplicitBucketHistogramUtils extends Object
Utilities for interacting with explicit bucket histograms.

This class is internal and is hence not for public use. Its APIs are unstable and can change at any time.

  • Field Details

    • DEFAULT_HISTOGRAM_BUCKET_BOUNDARIES

      public static final List<Double> DEFAULT_HISTOGRAM_BUCKET_BOUNDARIES
  • Constructor Details

    • ExplicitBucketHistogramUtils

      private ExplicitBucketHistogramUtils()
  • Method Details

    • createBoundaryArray

      public static double[] createBoundaryArray(List<Double> boundaries)
      Converts bucket boundary "convenient" configuration into the "more efficient" array.
    • findBucketIndex

      public static int findBucketIndex(double[] boundaries, double value)
      Finds the bucket index for a histogram.
      Parameters:
      boundaries - the array of bucket boundaries.
      value - The current measurement value
      Returns:
      The bucket index where the value should be recorded.
    • validateBucketBoundaries

      public static void validateBucketBoundaries(List<Double> boundaries)
      Validates errors in boundary configuration.
      Parameters:
      boundaries - The array of bucket boundaries.
      Throws:
      IllegalArgumentException - if boundaries are not specified correctly.