Class HistogramSnapshot.HistogramDataPointSnapshot
Object
DataPointSnapshot
DistributionDataPointSnapshot
HistogramDataPointSnapshot
- Enclosing class:
- HistogramSnapshot
public static final class HistogramSnapshot.HistogramDataPointSnapshot
extends DistributionDataPointSnapshot
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
-
Constructor Summary
ConstructorDescriptionHistogramDataPointSnapshot
(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
.int
The schema defines the scale of the native histogram, i.g. the granularity of the buckets.long
Number of observed zero values.double
All observations in [-nativeZeroThreshold; +nativeZeroThreshold] are treated as zero.boolean
boolean
Methods inherited from class DistributionDataPointSnapshot
getCount, getExemplars, getSum, hasCount, hasSum
Methods inherited from class 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.NaN
if not available.labels
- must not be null. UseLabels.EMPTY
if there are no labels.exemplars
- must not be null. UseExemplars.EMPTY
if 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. Use0L
if 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.EMPTY
if empty.nativeBucketsForNegativeValues
- must not benull
. UseNativeHistogramBuckets.EMPTY
if empty.sum
- sum of all observed values. Optional, useDouble.NaN
if not available.labels
- must not be null. UseLabels.EMPTY
if there are no labels.exemplars
- must not be null. UseExemplars.EMPTY
if 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. Use0L
if 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.EMPTY
if empty.nativeBucketsForNegativeValues
- must not benull
. UseNativeHistogramBuckets.EMPTY
if empty.sum
- sum of all observed values. Optional, useDouble.NaN
if not available.labels
- must not be null. UseLabels.EMPTY
if there are no labels.exemplars
- must not be null. UseExemplars.EMPTY
if 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. Use0L
if 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
-
hasNativeHistogramData
-
getClassicBuckets
Will return garbage ifhasClassicHistogramData()
isfalse
. -
getNativeSchema
The schema defines the scale of the native histogram, i.g. the granularity of the buckets. Current supported values are -4 <= schema <= 8. SeeNativeHistogramBuckets
for more info. This will return garbage ifhasNativeHistogramData()
isfalse
. -
getNativeZeroCount
Number of observed zero values. Will return garbage ifhasNativeHistogramData()
isfalse
. -
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
-