MCPcopy
hub / github.com/prometheus/prometheus / HistogramSamples

Method HistogramSamples

tsdb/record/record.go:530–540  ·  view source on GitHub ↗

HistogramSamples appends histogram samples in rec to the given slice.

(rec []byte, histograms []RefHistogramSample)

Source from the content-addressed store, hash-verified

528
529// HistogramSamples appends histogram samples in rec to the given slice.
530func (d *Decoder) HistogramSamples(rec []byte, histograms []RefHistogramSample) ([]RefHistogramSample, error) {
531 dec := encoding.Decbuf{B: rec}
532 switch typ := Type(dec.Byte()); typ {
533 case HistogramSamples, CustomBucketsHistogramSamples:
534 return d.histogramSamplesV1(&dec, histograms)
535 case HistogramSamplesV2:
536 return d.histogramSamplesV2(&dec, histograms)
537 default:
538 return nil, fmt.Errorf("invalid record type %v", typ)
539 }
540}
541
542// histogramSamplesV1 decodes V1 int-histogram records (BE64 baseRef/baseTime, varint deltas).
543func (d *Decoder) histogramSamplesV1(dec *encoding.Decbuf, histograms []RefHistogramSample) ([]RefHistogramSample, error) {

Calls 4

ByteMethod · 0.95
histogramSamplesV1Method · 0.95
histogramSamplesV2Method · 0.95
TypeTypeAlias · 0.70