MCPcopy Create free account
hub / github.com/prometheus/common / Decode

Method Decode

expfmt/decode.go:263–270  ·  view source on GitHub ↗

Decode calls the Decode method of the wrapped Decoder and then extracts the samples from the decoded MetricFamily into the provided model.Vector.

(s *model.Vector)

Source from the content-addressed store, hash-verified

261// Decode calls the Decode method of the wrapped Decoder and then extracts the
262// samples from the decoded MetricFamily into the provided model.Vector.
263func (sd *SampleDecoder) Decode(s *model.Vector) error {
264 err := sd.Dec.Decode(&sd.f)
265 if err != nil {
266 return err
267 }
268 *s, err = extractSamples(&sd.f, sd.Opts)
269 return err
270}
271
272// ExtractSamples builds a slice of samples from the provided metric
273// families. If an error occurs during sample extraction, it continues to

Callers 4

TestTextDecoderFunction · 0.95
TestProtoDecoderFunction · 0.95
TestOpenMetricsDecoderFunction · 0.95
TestOpenMetrics20DecoderFunction · 0.95

Calls 2

extractSamplesFunction · 0.85
DecodeMethod · 0.65

Tested by 4

TestTextDecoderFunction · 0.76
TestProtoDecoderFunction · 0.76
TestOpenMetricsDecoderFunction · 0.76
TestOpenMetrics20DecoderFunction · 0.76