Merge pull request #81608 from logicalhan/gauge-delete

add delete to gaugeVec, histogramVec, summaryVec since kubelet requir…
This commit is contained in:
Kubernetes Prow Robot 2019-08-19 20:44:32 -07:00 committed by GitHub
commit cd5bc3c383
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 0 deletions

View File

@ -148,3 +148,17 @@ func (v *GaugeVec) With(labels prometheus.Labels) GaugeMetric {
}
return v.GaugeVec.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 *GaugeVec) 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.GaugeVec.Delete(labels)
}

View File

@ -143,3 +143,17 @@ func (v *HistogramVec) With(labels prometheus.Labels) ObserverMetric {
}
return v.HistogramVec.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 *HistogramVec) 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.HistogramVec.Delete(labels)
}

View File

@ -150,3 +150,17 @@ func (v *SummaryVec) With(labels prometheus.Labels) ObserverMetric {
}
return v.SummaryVec.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 *SummaryVec) 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.SummaryVec.Delete(labels)
}