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

Function extractSamples

expfmt/decode.go:220–234  ·  view source on GitHub ↗
(f *dto.MetricFamily, o *DecodeOptions)

Source from the content-addressed store, hash-verified

218}
219
220func extractSamples(f *dto.MetricFamily, o *DecodeOptions) (model.Vector, error) {
221 switch f.GetType() {
222 case dto.MetricType_COUNTER:
223 return extractCounter(o, f), nil
224 case dto.MetricType_GAUGE:
225 return extractGauge(o, f), nil
226 case dto.MetricType_SUMMARY:
227 return extractSummary(o, f), nil
228 case dto.MetricType_UNTYPED:
229 return extractUntyped(o, f), nil
230 case dto.MetricType_HISTOGRAM, dto.MetricType_GAUGE_HISTOGRAM:
231 return extractHistogram(o, f), nil
232 }
233 return nil, fmt.Errorf("expfmt.extractSamples: unknown metric family type %v", f.GetType())
234}
235
236func extractCounter(o *DecodeOptions, f *dto.MetricFamily) model.Vector {
237 samples := make(model.Vector, 0, len(f.Metric))

Callers 2

DecodeMethod · 0.85
ExtractSamplesFunction · 0.85

Calls 5

extractCounterFunction · 0.85
extractGaugeFunction · 0.85
extractSummaryFunction · 0.85
extractUntypedFunction · 0.85
extractHistogramFunction · 0.85

Tested by

no test coverage detected