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

Method GetMetricWith

prometheus/gauge.go:222–228  ·  view source on GitHub ↗

GetMetricWith returns the Gauge for the given Labels map (the label names must match those of the variable labels in Desc). If that label map is accessed for the first time, a new Gauge is created. Implications of creating a Gauge without using it and keeping the Gauge for later use are the same as

(labels Labels)

Source from the content-addressed store, hash-verified

220// GetMetricWithLabelValues(...string). See there for pros and cons of the two
221// methods.
222func (v *GaugeVec) GetMetricWith(labels Labels) (Gauge, error) {
223 metric, err := v.MetricVec.GetMetricWith(labels)
224 if metric != nil {
225 return metric.(Gauge), err
226 }
227 return nil, err
228}
229
230// WithLabelValues works as GetMetricWithLabelValues, but panics where
231// GetMetricWithLabelValues would have returned an error. Not returning an

Callers 1

WithMethod · 0.95

Calls 1

GetMetricWithMethod · 0.65

Tested by

no test coverage detected