With works as GetMetricWith, but panics where GetMetricWithLabels would have returned an error. Not returning an error allows shortcuts like myVec.With(prometheus.Labels{"code": "404", "method": "GET"}).Add(42)
(labels Labels)
| 245 | // |
| 246 | // myVec.With(prometheus.Labels{"code": "404", "method": "GET"}).Add(42) |
| 247 | func (v *GaugeVec) With(labels Labels) Gauge { |
| 248 | g, err := v.GetMetricWith(labels) |
| 249 | if err != nil { |
| 250 | panic(err) |
| 251 | } |
| 252 | return g |
| 253 | } |
| 254 | |
| 255 | // CurryWith returns a vector curried with the provided labels, i.e. the |
| 256 | // returned vector has those labels pre-set for all labeled operations performed |