Module io.prometheus.metrics.model
Class HistogramSnapshot.HistogramDataPointSnapshot
java.lang.Object
io.prometheus.metrics.model.snapshots.DataPointSnapshot
io.prometheus.metrics.model.snapshots.DistributionDataPointSnapshot
io.prometheus.metrics.model.snapshots.HistogramSnapshot.HistogramDataPointSnapshot
- Enclosing class:
- HistogramSnapshot
public static final class HistogramSnapshot.HistogramDataPointSnapshot
extends DistributionDataPointSnapshot
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class -
Constructor Summary
ConstructorsConstructorDescriptionHistogramDataPointSnapshot(int nativeSchema, long nativeZeroCount, double nativeZeroThreshold, NativeHistogramBuckets nativeBucketsForPositiveValues, NativeHistogramBuckets nativeBucketsForNegativeValues, double sum, Labels labels, Exemplars exemplars, long createdTimestampMillis) Constructor for native histograms (as opposed to classic histograms).HistogramDataPointSnapshot(ClassicHistogramBuckets classicBuckets, double sum, Labels labels, Exemplars exemplars, long createdTimestampMillis) Constructor for classic histograms (as opposed to native histograms).HistogramDataPointSnapshot(ClassicHistogramBuckets classicBuckets, int nativeSchema, long nativeZeroCount, double nativeZeroThreshold, NativeHistogramBuckets nativeBucketsForPositiveValues, NativeHistogramBuckets nativeBucketsForNegativeValues, double sum, Labels labels, Exemplars exemplars, long createdTimestampMillis) Constructor for a histogram with both, classic and native data.HistogramDataPointSnapshot(ClassicHistogramBuckets classicBuckets, int nativeSchema, long nativeZeroCount, double nativeZeroThreshold, NativeHistogramBuckets nativeBucketsForPositiveValues, NativeHistogramBuckets nativeBucketsForNegativeValues, double sum, Labels labels, Exemplars exemplars, long createdTimestampMillis, long scrapeTimestampMillis) Constructor with an additional scrape timestamp. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()Will return garbage ifhasClassicHistogramData()isfalse.Will return garbage ifhasNativeHistogramData()isfalse.Will return garbage ifhasNativeHistogramData()isfalse.intThe schema defines the scale of the native histogram, i.g. the granularity of the buckets.longNumber of observed zero values.doubleAll observations in [-nativeZeroThreshold; +nativeZeroThreshold] are treated as zero.booleanbooleanMethods inherited from class io.prometheus.metrics.model.snapshots.DistributionDataPointSnapshot
getCount, getExemplars, getSum, hasCount, hasSumMethods inherited from class io.prometheus.metrics.model.snapshots.DataPointSnapshot
getCreatedTimestampMillis, getLabels, getScrapeTimestampMillis, hasCreatedTimestamp, hasScrapeTimestamp
-
Constructor Details
-
HistogramDataPointSnapshot
public HistogramDataPointSnapshot(ClassicHistogramBuckets classicBuckets, double sum, Labels labels, Exemplars exemplars, long createdTimestampMillis) Constructor for classic histograms (as opposed to native histograms).To create a new
HistogramSnapshot.HistogramDataPointSnapshot, you can either call the constructor directly or use the Builder withHistogramSnapshot.builder().- Parameters:
classicBuckets- required. Must not be empty. Must at least contain the +Inf bucket.sum- sum of all observed values. Optional, passDouble.NaNif not available.labels- must not be null. UseLabels.EMPTYif there are no labels.exemplars- must not be null. UseExemplars.EMPTYif there are no Exemplars.createdTimestampMillis- timestamp (as inSystem.currentTimeMillis()) when the time series (this specific set of labels) was created (or reset to zero). It's optional. Use0Lif there is no created timestamp.
-
HistogramDataPointSnapshot
public HistogramDataPointSnapshot(int nativeSchema, long nativeZeroCount, double nativeZeroThreshold, NativeHistogramBuckets nativeBucketsForPositiveValues, NativeHistogramBuckets nativeBucketsForNegativeValues, double sum, Labels labels, Exemplars exemplars, long createdTimestampMillis) Constructor for native histograms (as opposed to classic histograms).To create a new
HistogramSnapshot.HistogramDataPointSnapshot, you can either call the constructor directly or use the Builder withHistogramSnapshot.builder().- Parameters:
nativeSchema- number in [-4, 8]. See Prometheus client_model metrics.proto.nativeZeroCount- number of observed zero values (zero is special because there is no histogram bucket for zero values).nativeZeroThreshold- observations in [-zeroThreshold, +zeroThreshold] are treated as zero. This is to avoid creating a large number of buckets if observations fluctuate around zero.nativeBucketsForPositiveValues- must not benull. UseNativeHistogramBuckets.EMPTYif empty.nativeBucketsForNegativeValues- must not benull. UseNativeHistogramBuckets.EMPTYif empty.sum- sum of all observed values. Optional, useDouble.NaNif not available.labels- must not be null. UseLabels.EMPTYif there are no labels.exemplars- must not be null. UseExemplars.EMPTYif there are no Exemplars.createdTimestampMillis- timestamp (as inSystem.currentTimeMillis()) when the time series (this specific set of labels) was created (or reset to zero). It's optional. Use0Lif there is no created timestamp.
-
HistogramDataPointSnapshot
public HistogramDataPointSnapshot(ClassicHistogramBuckets classicBuckets, int nativeSchema, long nativeZeroCount, double nativeZeroThreshold, NativeHistogramBuckets nativeBucketsForPositiveValues, NativeHistogramBuckets nativeBucketsForNegativeValues, double sum, Labels labels, Exemplars exemplars, long createdTimestampMillis) Constructor for a histogram with both, classic and native data.To create a new
HistogramSnapshot.HistogramDataPointSnapshot, you can either call the constructor directly or use the Builder withHistogramSnapshot.builder().- Parameters:
classicBuckets- required. Must not be empty. Must at least contain the +Inf bucket.nativeSchema- number in [-4, 8]. See Prometheus client_model metrics.proto.nativeZeroCount- number of observed zero values (zero is special because there is no histogram bucket for zero values).nativeZeroThreshold- observations in [-zeroThreshold, +zeroThreshold] are treated as zero. This is to avoid creating a large number of buckets if observations fluctuate around zero.nativeBucketsForPositiveValues- must not benull. UseNativeHistogramBuckets.EMPTYif empty.nativeBucketsForNegativeValues- must not benull. UseNativeHistogramBuckets.EMPTYif empty.sum- sum of all observed values. Optional, useDouble.NaNif not available.labels- must not be null. UseLabels.EMPTYif there are no labels.exemplars- must not be null. UseExemplars.EMPTYif there are no Exemplars.createdTimestampMillis- timestamp (as inSystem.currentTimeMillis()) when the time series (this specific set of labels) was created (or reset to zero). It's optional. Use0Lif there is no created timestamp.
-
HistogramDataPointSnapshot
public HistogramDataPointSnapshot(ClassicHistogramBuckets classicBuckets, int nativeSchema, long nativeZeroCount, double nativeZeroThreshold, NativeHistogramBuckets nativeBucketsForPositiveValues, NativeHistogramBuckets nativeBucketsForNegativeValues, double sum, Labels labels, Exemplars exemplars, long createdTimestampMillis, long scrapeTimestampMillis) Constructor with an additional scrape timestamp. This is only useful in rare cases as the scrape timestamp is usually set by the Prometheus server during scraping. Exceptions include mirroring metrics with given timestamps from other metric sources.
-
-
Method Details
-
hasClassicHistogramData
public boolean hasClassicHistogramData() -
hasNativeHistogramData
public boolean hasNativeHistogramData() -
getClassicBuckets
Will return garbage ifhasClassicHistogramData()isfalse. -
getNativeSchema
public int getNativeSchema()The schema defines the scale of the native histogram, i.g. the granularity of the buckets. Current supported values are -4 <= schema <= 8. SeeNativeHistogramBucketsfor more info. This will return garbage ifhasNativeHistogramData()isfalse. -
getNativeZeroCount
public long getNativeZeroCount()Number of observed zero values. Will return garbage ifhasNativeHistogramData()isfalse. -
getNativeZeroThreshold
public double getNativeZeroThreshold()All observations in [-nativeZeroThreshold; +nativeZeroThreshold] are treated as zero. This is useful to avoid creation of a large number of buckets if observations fluctuate around zero. Will return garbage ifhasNativeHistogramData()isfalse. -
getNativeBucketsForPositiveValues
Will return garbage ifhasNativeHistogramData()isfalse. -
getNativeBucketsForNegativeValues
Will return garbage ifhasNativeHistogramData()isfalse. -
builder
-