Class ClassicHistogramBuckets
java.lang.Object
io.prometheus.metrics.model.snapshots.ClassicHistogramBuckets
- All Implemented Interfaces:
Iterable<ClassicHistogramBucket>
Immutable container for histogram buckets with fixed bucket boundaries. Note that the counts are
not cumulative.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final long[]static final ClassicHistogramBucketsUsed in native histograms to indicate that no classic histogram buckets are present.private final double[] -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateClassicHistogramBuckets(double[] upperBounds, long[] counts) -
Method Summary
Modifier and TypeMethodDescriptionprivate List<ClassicHistogramBucket> asList()builder()To create newClassicHistogramBuckets, you can either use one of the staticof(...)methods, or usebuilder().longgetCount(int i) The count is not cumulative.doublegetUpperBound(int i) booleanisEmpty()iterator()static ClassicHistogramBucketsof(double[] upperBounds, long[] counts) To create newClassicHistogramBuckets, you can either use one of the staticof(...)methods, or usebuilder().static ClassicHistogramBucketsTo create newClassicHistogramBuckets, you can either use one of the staticof(...)methods, or usebuilder().static ClassicHistogramBucketsTo create newClassicHistogramBuckets, you can either use one of the staticof(...)methods, or usebuilder().intsize()private static voidsort(double[] upperBounds, long[] counts) private static voidsortAndValidate(double[] upperBounds, long[] counts) stream()private static voidswap(int i, int j, double[] upperBounds, long[] counts) private static voidvalidate(double[] upperBounds, long[] counts) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Iterable
forEach, spliterator
-
Field Details
-
EMPTY
Used in native histograms to indicate that no classic histogram buckets are present. -
upperBounds
private final double[] upperBounds -
counts
private final long[] counts
-
-
Constructor Details
-
ClassicHistogramBuckets
private ClassicHistogramBuckets(double[] upperBounds, long[] counts)
-
-
Method Details
-
of
To create newClassicHistogramBuckets, you can either use one of the staticof(...)methods, or usebuilder().This method will create a copy of upperBounds and counts.
- Parameters:
upperBounds- must have the same length as counts. Must not contain duplicates. Must contain at leastDouble.POSITIVE_INFINITYfor the+Infbucket. An upper bound must not beDouble.NaN. The upperBounds array does not need to be sorted.counts- must have the same length asupperBounds. The entry at indexiis the count for theupperBoundsat indexi. For each count,Number.longValue()is called to get the value. Counts are not cumulative. Counts must not be negative.
-
of
To create newClassicHistogramBuckets, you can either use one of the staticof(...)methods, or usebuilder().This method will create a copy of upperBounds and counts.
- Parameters:
upperBounds- must have the same length as counts. Must not contain duplicates. Must contain at leastDouble.POSITIVE_INFINITYfor the+Infbucket. An upper bound must not beDouble.NaN. The upperBounds array does not need to be sorted.counts- must have the same length asupperBounds. The entry at indexiis the count for theupperBoundsat indexi. For each count,Number.longValue()is called to get the value. Counts are not cumulative. Counts must not be negative.
-
of
To create newClassicHistogramBuckets, you can either use one of the staticof(...)methods, or usebuilder().This method will create a copy of upperBounds and counts.
- Parameters:
upperBounds- must have the same length as counts. Must not contain duplicates. Must contain at leastDouble.POSITIVE_INFINITYfor the+Infbucket. An upper bound must not beDouble.NaN. The upperBounds array does not need to be sorted.counts- must have the same length asupperBounds. The entry at indexiis the count for theupperBoundsat indexi. Counts are not cumulative. Counts must not be negative.
-
sortAndValidate
private static void sortAndValidate(double[] upperBounds, long[] counts) -
sort
private static void sort(double[] upperBounds, long[] counts) -
swap
private static void swap(int i, int j, double[] upperBounds, long[] counts) -
validate
private static void validate(double[] upperBounds, long[] counts) -
size
public int size() -
getUpperBound
public double getUpperBound(int i) -
getCount
public long getCount(int i) The count is not cumulative. -
isEmpty
public boolean isEmpty() -
asList
-
iterator
- Specified by:
iteratorin interfaceIterable<ClassicHistogramBucket>
-
stream
-
builder
To create newClassicHistogramBuckets, you can either use one of the staticof(...)methods, or usebuilder().
-