Merge pull request #81579 from logicalhan/counter-delete

add delete to counterVec wrapper, since we require it in the kubelet
This commit is contained in:
Kubernetes Prow Robot 2019-08-19 02:53:51 -07:00 committed by GitHub
commit 4923292161
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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)
}