Class Histogram.DataPoint

java.lang.Object
io.prometheus.metrics.core.metrics.Histogram.DataPoint
All Implemented Interfaces:
DataPoint, DistributionDataPoint, TimerApi
Enclosing class:
Histogram

public class Histogram.DataPoint extends Object implements DistributionDataPoint
  • Field Details

    • classicBuckets

      private final LongAdder[] classicBuckets
    • nativeBucketsForPositiveValues

      private final ConcurrentHashMap<Integer, LongAdder> nativeBucketsForPositiveValues
    • nativeBucketsForNegativeValues

      private final ConcurrentHashMap<Integer, LongAdder> nativeBucketsForNegativeValues
    • nativeZeroCount

      private final LongAdder nativeZeroCount
    • count

      private final LongAdder count
    • sum

      private final DoubleAdder sum
    • nativeSchema

      private volatile int nativeSchema
    • nativeZeroThreshold

      private volatile double nativeZeroThreshold
    • createdTimeMillis

      private volatile long createdTimeMillis
    • buffer

      private final Buffer buffer
    • resetDurationExpired

      private volatile boolean resetDurationExpired
    • exemplarSampler

      private final ExemplarSampler exemplarSampler
  • Constructor Details

    • DataPoint

      private DataPoint()
  • Method Details

    • getSum

      public double getSum()
      Description copied from interface: DistributionDataPoint
      Get the sum of all observed values.
      Specified by:
      getSum in interface DistributionDataPoint
    • getCount

      public long getCount()
      Description copied from interface: DistributionDataPoint
      Get the count of observations.
      Specified by:
      getCount in interface DistributionDataPoint
    • observe

      public void observe(double value)
      Description copied from interface: DistributionDataPoint
      Observe value.
      Specified by:
      observe in interface DistributionDataPoint
    • observeWithExemplar

      public void observeWithExemplar(double value, Labels labels)
      Description copied from interface: DistributionDataPoint
      Observe value, and create a custom exemplar with the given labels.
      Specified by:
      observeWithExemplar in interface DistributionDataPoint
    • doObserve

      private void doObserve(double value, boolean fromBuffer)
    • collect

    • addToNativeBucket

      private boolean addToNativeBucket(double value, ConcurrentHashMap<Integer, LongAdder> buckets)
    • 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

      private void maybeScaleDown(AtomicBoolean wasReset)
    • maybeReset

      private boolean maybeReset()
    • maybeWidenZeroBucket

      private boolean maybeWidenZeroBucket()
    • mergeWithZeroBucket

      private void mergeWithZeroBucket(int index, Map<Integer, LongAdder> buckets)
    • nativeBucketIndexToUpperBound

      private double nativeBucketIndexToUpperBound(int schema, int index)
    • calcUpperBound

      private double calcUpperBound(int schema, int index)
    • findSmallestIndex

      private int findSmallestIndex(Map<Integer, LongAdder> nativeBuckets)
    • doubleBucketWidth

      private void doubleBucketWidth()
    • doubleBucketWidth

      private void doubleBucketWidth(Map<Integer, LongAdder> buckets)
    • toBucketList

    • maybeScheduleNextReset

      private void maybeScheduleNextReset()