MCPcopy
hub / github.com/prometheus/prometheus / FloatHistogram

Struct FloatHistogram

model/histogram/float_histogram.go:33–62  ·  view source on GitHub ↗

FloatHistogram is similar to Histogram but uses float64 for all counts. Additionally, bucket counts are absolute and not deltas. A FloatHistogram is needed by PromQL to handle operations that might result in fractional counts. Since the counts in a histogram are unlikely to be too large to be repre

Source from the content-addressed store, hash-verified

31// used to represent a histogram with integer counts and thus serves as a more
32// generalized representation.
33type FloatHistogram struct {
34 // Counter reset information.
35 CounterResetHint CounterResetHint
36 // Currently valid schema numbers are -4 <= n <= 8 for exponential buckets.
37 // They are all for base-2 bucket schemas, where 1 is a bucket boundary in
38 // each case, and then each power of two is divided into 2^n logarithmic buckets.
39 // Or in other words, each bucket boundary is the previous boundary times
40 // 2^(2^-n). Another valid schema number is -53 for custom buckets, defined by
41 // the CustomValues field.
42 Schema int32
43 // Width of the zero bucket.
44 ZeroThreshold float64
45 // Observations falling into the zero bucket. Must be zero or positive.
46 ZeroCount float64
47 // Total number of observations. Must be zero or positive.
48 Count float64
49 // Sum of observations. This is also used as the stale marker.
50 Sum float64
51 // Spans for positive and negative buckets (see Span below).
52 PositiveSpans, NegativeSpans []Span
53 // Observation counts in buckets. Each represents an absolute count and
54 // must be zero or positive.
55 PositiveBuckets, NegativeBuckets []float64
56 // Holds the custom (usually upper) bounds for bucket definitions, otherwise nil.
57 // This slice is interned, to be treated as immutable and copied by reference.
58 // These numbers should be strictly increasing. This field is only used when the
59 // schema is for custom buckets, and the ZeroThreshold, ZeroCount, NegativeSpans
60 // and NegativeBuckets fields are not used in that case.
61 CustomValues []float64
62}
63
64func (h *FloatHistogram) UsesCustomBuckets() bool {
65 return IsCustomBucketsSchema(h.Schema)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected