Class ExplicitBucketHistogramUtils
- java.lang.Object
-
- io.opentelemetry.sdk.metrics.internal.aggregator.ExplicitBucketHistogramUtils
-
public final class ExplicitBucketHistogramUtils extends java.lang.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 Summary
Fields Modifier and Type Field Description static java.util.List<java.lang.Double>
DEFAULT_HISTOGRAM_BUCKET_BOUNDARIES
-
Constructor Summary
Constructors Modifier Constructor Description private
ExplicitBucketHistogramUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static double[]
createBoundaryArray(java.util.List<java.lang.Double> boundaries)
Converts bucket boundary "convenient" configuration into the "more efficient" array.static int
findBucketIndex(double[] boundaries, double value)
Finds the bucket index for a histogram.static void
validateBucketBoundaries(java.util.List<java.lang.Double> boundaries)
Validates errors in boundary configuration.
-
-
-
Method Detail
-
createBoundaryArray
public static double[] createBoundaryArray(java.util.List<java.lang.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(java.util.List<java.lang.Double> boundaries)
Validates errors in boundary configuration.- Parameters:
boundaries
- The array of bucket boundaries.- Throws:
java.lang.IllegalArgumentException
- if boundaries are not specified correctly.
-
-