Class NativeHistogramBuckets
java.lang.Object
io.prometheus.metrics.model.snapshots.NativeHistogramBuckets
- All Implemented Interfaces:
Iterable<NativeHistogramBucket>
Immutable representation of native histogram buckets.
The bucket index defines the boundaries of the bucket, depending on the histogram's schema.
base = 2^(2^-schema)
lower bound = base^(index - 1)
upper bound = base^index
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int[]private final long[]static final NativeHistogramBuckets -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate List<NativeHistogramBucket> asList()builder()intgetBucketIndex(int i) longgetCount(int i) iterator()static NativeHistogramBucketsof(int[] bucketIndexes, long[] counts) To create a newNativeHistogramBucketsinstance, you can either use one of the staticof(...)methods, or usebuilder().static NativeHistogramBucketsTo create a newNativeHistogramBucketsinstance, you can either use one of the staticof(...)methods, or usebuilder().intsize()private static voidsort(int[] bucketIndexes, long[] counts) private static voidsortAndValidate(int[] bucketIndexes, long[] counts) stream()private static voidswap(int i, int j, int[] bucketIndexes, long[] counts) private static voidvalidate(int[] bucketIndexes, 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
-
bucketIndexes
private final int[] bucketIndexes -
counts
private final long[] counts
-
-
Constructor Details
-
NativeHistogramBuckets
private NativeHistogramBuckets(int[] bucketIndexes, long[] counts)
-
-
Method Details
-
of
To create a newNativeHistogramBucketsinstance, you can either use one of the staticof(...)methods, or usebuilder().- Parameters:
bucketIndexes- see class javadoc ofNativeHistogramBuckets. May be empty.counts- must have the same length as bucketIndexes
-
of
To create a newNativeHistogramBucketsinstance, you can either use one of the staticof(...)methods, or usebuilder().- Parameters:
bucketIndexes- see class javadoc ofNativeHistogramBuckets. May be empty.counts- must have the same size as bucketIndexes
-
size
public int size() -
asList
-
iterator
- Specified by:
iteratorin interfaceIterable<NativeHistogramBucket>
-
stream
-
getBucketIndex
public int getBucketIndex(int i) -
getCount
public long getCount(int i) -
sortAndValidate
private static void sortAndValidate(int[] bucketIndexes, long[] counts) -
sort
private static void sort(int[] bucketIndexes, long[] counts) -
swap
private static void swap(int i, int j, int[] bucketIndexes, long[] counts) -
validate
private static void validate(int[] bucketIndexes, long[] counts) -
builder
-