add delete to counterVec wrapper, since we require it in the kubelet

This commit is contained in:
Han Kang 2019-08-18 18:54:37 -07:00
parent 8f0d626228
commit 3150b2b437

View File

@ -149,3 +149,17 @@ func (v *CounterVec) With(labels prometheus.Labels) CounterMetric {
}
return v.CounterVec.With(labels)
}
// 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 match an actual metric, so the method will always return false in
// that case.
func (v *CounterVec) Delete(labels prometheus.Labels) bool {
if !v.IsCreated() {
return false // since we haven't created the metric, we haven't deleted a metric with the passed in values
}
return v.CounterVec.Delete(labels)
}