MCPcopy
hub / github.com/prometheus/prometheus / EncodeFloatHistogram

Function EncodeFloatHistogram

tsdb/record/record.go:1336–1374  ·  view source on GitHub ↗

EncodeFloatHistogram encodes the Float Histogram into a byte slice.

(buf *encoding.Encbuf, h *histogram.FloatHistogram)

Source from the content-addressed store, hash-verified

1334
1335// EncodeFloatHistogram encodes the Float Histogram into a byte slice.
1336func EncodeFloatHistogram(buf *encoding.Encbuf, h *histogram.FloatHistogram) {
1337 buf.PutByte(byte(h.CounterResetHint))
1338
1339 buf.PutVarint64(int64(h.Schema))
1340 buf.PutBEFloat64(h.ZeroThreshold)
1341
1342 buf.PutBEFloat64(h.ZeroCount)
1343 buf.PutBEFloat64(h.Count)
1344 buf.PutBEFloat64(h.Sum)
1345
1346 buf.PutUvarint(len(h.PositiveSpans))
1347 for _, s := range h.PositiveSpans {
1348 buf.PutVarint64(int64(s.Offset))
1349 buf.PutUvarint32(s.Length)
1350 }
1351
1352 buf.PutUvarint(len(h.NegativeSpans))
1353 for _, s := range h.NegativeSpans {
1354 buf.PutVarint64(int64(s.Offset))
1355 buf.PutUvarint32(s.Length)
1356 }
1357
1358 buf.PutUvarint(len(h.PositiveBuckets))
1359 for _, b := range h.PositiveBuckets {
1360 buf.PutBEFloat64(b)
1361 }
1362
1363 buf.PutUvarint(len(h.NegativeBuckets))
1364 for _, b := range h.NegativeBuckets {
1365 buf.PutBEFloat64(b)
1366 }
1367
1368 if histogram.IsCustomBucketsSchema(h.Schema) {
1369 buf.PutUvarint(len(h.CustomValues))
1370 for _, v := range h.CustomValues {
1371 buf.PutBEFloat64(v)
1372 }
1373 }
1374}

Calls 6

IsCustomBucketsSchemaFunction · 0.92
PutByteMethod · 0.80
PutVarint64Method · 0.80
PutBEFloat64Method · 0.80
PutUvarintMethod · 0.80
PutUvarint32Method · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…