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

Function NewInfoVec

prometheus/example_metricvec_test.go:55–65  ·  prometheus/example_metricvec_test.go::NewInfoVec
(name, help string, labelNames []string)

Source from the content-addressed store, hash-verified

53}
54
55func NewInfoVec(name, help string, labelNames []string) *InfoVec {
56 desc := prometheus.NewDesc(name, help, labelNames, nil)
57 return &InfoVec{
58 MetricVec: prometheus.NewMetricVec(desc, func(lvs ...string) prometheus.Metric {
59 if len(lvs) != len(labelNames) {
60 panic("inconsistent label cardinality")
61 }
62 return Info{desc: desc, labelPairs: prometheus.MakeLabelPairs(desc, lvs)}
63 }),
64 }
65}
66
67func (v *InfoVec) GetMetricWithLabelValues(lvs ...string) (Info, error) {
68 metric, err := v.MetricVec.GetMetricWithLabelValues(lvs...)

Callers 1

ExampleMetricVecFunction · 0.85

Calls 3

NewDescFunction · 0.92
NewMetricVecFunction · 0.92
MakeLabelPairsFunction · 0.92

Tested by

no test coverage detected