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

Function ExtractSamples

expfmt/decode.go:204–218  ·  view source on GitHub ↗

ExtractSamples builds a slice of samples from the provided metric families. If an error occurs during sample extraction, it continues to extract from the remaining metric families. The returned error is the last error that has occurred.

(o *DecodeOptions, fams ...*dto.MetricFamily)

Source from the content-addressed store, hash-verified

202// extract from the remaining metric families. The returned error is the last
203// error that has occurred.
204func ExtractSamples(o *DecodeOptions, fams ...*dto.MetricFamily) (model.Vector, error) {
205 var (
206 all model.Vector
207 lastErr error
208 )
209 for _, f := range fams {
210 some, err := extractSamples(f, o)
211 if err != nil {
212 lastErr = err
213 continue
214 }
215 all = append(all, some...)
216 }
217 return all, lastErr
218}
219
220func extractSamples(f *dto.MetricFamily, o *DecodeOptions) (model.Vector, error) {
221 switch f.GetType() {

Callers 1

TestExtractSamplesFunction · 0.85

Calls 1

extractSamplesFunction · 0.85

Tested by 1

TestExtractSamplesFunction · 0.68