MCPcopy
hub / github.com/prometheus/client_golang / GetMetricWithLabelValues

Method GetMetricWithLabelValues

prometheus/counter.go:248–254  ·  view source on GitHub ↗

GetMetricWithLabelValues returns the Counter for the given slice of label values (same order as the variable labels in Desc). If that combination of label values is accessed for the first time, a new Counter is created. It is possible to call this method without using the returned Counter to only c

(lvs ...string)

Source from the content-addressed store, hash-verified

246// with a performance overhead (for creating and processing the Labels map).
247// See also the GaugeVec example.
248func (v *CounterVec) GetMetricWithLabelValues(lvs ...string) (Counter, error) {
249 metric, err := v.MetricVec.GetMetricWithLabelValues(lvs...)
250 if metric != nil {
251 return metric.(Counter), err
252 }
253 return nil, err
254}
255
256// GetMetricWith returns the Counter for the given Labels map (the label names
257// must match those of the variable labels in Desc). If that label map is

Callers 3

ExampleRegisterFunction · 0.95
WithLabelValuesMethod · 0.95

Calls 1

Tested by 2

ExampleRegisterFunction · 0.76