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

Method Delete

prometheus/vec.go:95–105  ·  view source on GitHub ↗

Delete deletes the metric where the variable labels are the same as those passed in as labels. It returns true if a metric was deleted. It is not an error if the number and names of the Labels are inconsistent with those of the VariableLabels in Desc. However, such inconsistent Labels can never mat

(labels Labels)

Source from the content-addressed store, hash-verified

93// This method is used for the same purpose as DeleteLabelValues(...string). See
94// there for pros and cons of the two methods.
95func (m *MetricVec) Delete(labels Labels) bool {
96 labels, closer := constrainLabels(m.desc, labels)
97 defer closer()
98
99 h, err := m.hashLabels(labels)
100 if err != nil {
101 return false
102 }
103
104 return m.deleteByHashWithLabels(h, labels, m.curry)
105}
106
107// DeletePartialMatch deletes all metrics where the variable labels contain all of those
108// passed in as labels. The order of the labels does not matter.

Callers 6

ExampleCounterVecFunction · 0.45
maybeWidenZeroBucketMethod · 0.45
deleteSyncMapFunction · 0.45
testDeleteFunction · 0.45
testCurryVecFunction · 0.45
testConstrainedCurryVecFunction · 0.45

Calls 3

hashLabelsMethod · 0.95
constrainLabelsFunction · 0.85

Tested by 4

ExampleCounterVecFunction · 0.36
testDeleteFunction · 0.36
testCurryVecFunction · 0.36
testConstrainedCurryVecFunction · 0.36