Class Histogram.DataPoint
java.lang.Object
io.prometheus.metrics.core.metrics.Histogram.DataPoint
- All Implemented Interfaces:
DataPoint, DistributionDataPoint, TimerApi
- Enclosing class:
Histogram
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Bufferprivate final LongAdder[]private final LongAdderprivate longprivate final ExemplarSamplerprivate final ConcurrentHashMap<Integer, LongAdder> private final ConcurrentHashMap<Integer, LongAdder> private intprivate final LongAdderprivate doubleprivate booleanprivate final DoubleAdder -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate booleanaddToNativeBucket(double value, ConcurrentHashMap<Integer, LongAdder> buckets) private doublecalcUpperBound(int schema, int index) private voiddoObserve(double value, boolean fromBuffer) private voidprivate voiddoubleBucketWidth(Map<Integer, LongAdder> buckets) private intfindBucketIndex(double value) private intfindIndex(double[] bounds, double frac) private intfindSmallestIndex(Map<Integer, LongAdder> nativeBuckets) longgetCount()Get the count of observations.doublegetSum()Get the sum of all observed values.private booleanprivate voidmaybeResetOrScaleDown(double value, boolean nativeBucketCreated) Makes sure that the number of native buckets does not exceed nativeMaxBuckets.private voidmaybeScaleDown(AtomicBoolean wasReset) private voidprivate booleanprivate voidmergeWithZeroBucket(int index, Map<Integer, LongAdder> buckets) private doublenativeBucketIndexToUpperBound(int schema, int index) voidobserve(double value) Observevalue.voidobserveWithExemplar(double value, Labels labels) Observevalue, and create a custom exemplar with the given labels.private NativeHistogramBucketsMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface DistributionDataPoint
startTimerMethods inherited from interface TimerApi
time, time, timeChecked
-
Field Details
-
classicBuckets
-
nativeBucketsForPositiveValues
-
nativeBucketsForNegativeValues
-
nativeZeroCount
-
count
-
sum
-
nativeSchema
private volatile int nativeSchema -
nativeZeroThreshold
private volatile double nativeZeroThreshold -
createdTimeMillis
private volatile long createdTimeMillis -
buffer
-
resetDurationExpired
private volatile boolean resetDurationExpired -
exemplarSampler
-
-
Constructor Details
-
DataPoint
private DataPoint()
-
-
Method Details
-
getSum
public double getSum()Description copied from interface:DistributionDataPointGet the sum of all observed values.- Specified by:
getSumin interfaceDistributionDataPoint
-
getCount
public long getCount()Description copied from interface:DistributionDataPointGet the count of observations.- Specified by:
getCountin interfaceDistributionDataPoint
-
observe
public void observe(double value) Description copied from interface:DistributionDataPointObservevalue.- Specified by:
observein interfaceDistributionDataPoint
-
observeWithExemplar
Description copied from interface:DistributionDataPointObservevalue, and create a custom exemplar with the given labels.- Specified by:
observeWithExemplarin interfaceDistributionDataPoint
-
doObserve
private void doObserve(double value, boolean fromBuffer) -
collect
-
addToNativeBucket
-
findBucketIndex
private int findBucketIndex(double value) -
findIndex
private int findIndex(double[] bounds, double frac) -
maybeResetOrScaleDown
private void maybeResetOrScaleDown(double value, boolean nativeBucketCreated) Makes sure that the number of native buckets does not exceed nativeMaxBuckets.- If the histogram has already been scaled down (nativeSchema invalid input: '<' initialSchema) reset after resetIntervalExpired to get back to the original schema.
- If a new bucket was created and we now exceed nativeMaxBuckets run maybeScaleDown() to scale down
-
maybeScaleDown
-
maybeReset
private boolean maybeReset() -
maybeWidenZeroBucket
private boolean maybeWidenZeroBucket() -
mergeWithZeroBucket
-
nativeBucketIndexToUpperBound
private double nativeBucketIndexToUpperBound(int schema, int index) -
calcUpperBound
private double calcUpperBound(int schema, int index) -
findSmallestIndex
-
doubleBucketWidth
private void doubleBucketWidth() -
doubleBucketWidth
-
toBucketList
-
maybeScheduleNextReset
private void maybeScheduleNextReset()
-