MCPcopy
hub / github.com/prometheus/prometheus / Samples

Method Samples

tsdb/record/record.go:328–338  ·  view source on GitHub ↗

Samples appends samples in rec to the given slice.

(rec []byte, samples []RefSample)

Source from the content-addressed store, hash-verified

326
327// Samples appends samples in rec to the given slice.
328func (d *Decoder) Samples(rec []byte, samples []RefSample) ([]RefSample, error) {
329 dec := encoding.Decbuf{B: rec}
330 switch typ := dec.Byte(); Type(typ) {
331 case Samples:
332 return d.samplesV1(&dec, samples)
333 case SamplesV2:
334 return d.samplesV2(&dec, samples)
335 default:
336 return nil, fmt.Errorf("invalid record type %v, expected Samples(2) or SamplesV2(11)", typ)
337 }
338}
339
340// samplesV1 appends samples in rec to the given slice, while ignoring ST information.
341func (*Decoder) samplesV1(dec *encoding.Decbuf, samples []RefSample) ([]RefSample, error) {

Callers 15

loadWALMethod · 0.95
loadWBLMethod · 0.95
testOOOWALWriteFunction · 0.95
readTestWALFunction · 0.95
testOOOWALWriteAppendV2Function · 0.95
TestRecord_EncodeDecodeFunction · 0.95
TestRecord_CorruptedFunction · 0.95
readSegmentMethod · 0.95
TestCheckpointFunction · 0.95
readWALSamplesFunction · 0.95
collectOOORecordsMethod · 0.45

Calls 4

ByteMethod · 0.95
samplesV1Method · 0.95
samplesV2Method · 0.95
TypeTypeAlias · 0.70

Tested by 15

testOOOWALWriteFunction · 0.76
readTestWALFunction · 0.76
testOOOWALWriteAppendV2Function · 0.76
TestRecord_EncodeDecodeFunction · 0.76
TestRecord_CorruptedFunction · 0.76
TestCheckpointFunction · 0.76
readWALSamplesFunction · 0.76
TestEncodeDecodeFunction · 0.36
BenchmarkEncode_SamplesFunction · 0.36
BenchmarkDecode_SamplesFunction · 0.36