Skip to content

Commit

Permalink
Merge pull request #85202 from RainbowMango/pr_add_Reset_API_to_compo…
Browse files Browse the repository at this point in the history
…nent-base

Add Reset() API to stability framework
  • Loading branch information
k8s-ci-robot committed Nov 13, 2019
2 parents ce0e9ba + ea40540 commit 63a5cb3
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
9 changes: 9 additions & 0 deletions staging/src/k8s.io/component-base/metrics/counter.go
Expand Up @@ -159,3 +159,12 @@ func (v *CounterVec) Delete(labels map[string]string) bool {
}
return v.CounterVec.Delete(labels)
}

// Reset deletes all metrics in this vector.
func (v *CounterVec) Reset() {
if !v.IsCreated() {
return
}

v.CounterVec.Reset()
}
9 changes: 9 additions & 0 deletions staging/src/k8s.io/component-base/metrics/gauge.go
Expand Up @@ -161,6 +161,15 @@ func (v *GaugeVec) Delete(labels map[string]string) bool {
return v.GaugeVec.Delete(labels)
}

// Reset deletes all metrics in this vector.
func (v *GaugeVec) Reset() {
if !v.IsCreated() {
return
}

v.GaugeVec.Reset()
}

func newGaugeFunc(opts GaugeOpts, function func() float64, v semver.Version) GaugeFunc {
g := NewGauge(&opts)

Expand Down
9 changes: 9 additions & 0 deletions staging/src/k8s.io/component-base/metrics/histogram.go
Expand Up @@ -166,3 +166,12 @@ func (v *HistogramVec) Delete(labels map[string]string) bool {
}
return v.HistogramVec.Delete(labels)
}

// Reset deletes all metrics in this vector.
func (v *HistogramVec) Reset() {
if !v.IsCreated() {
return
}

v.HistogramVec.Reset()
}
9 changes: 9 additions & 0 deletions staging/src/k8s.io/component-base/metrics/summary.go
Expand Up @@ -160,3 +160,12 @@ func (v *SummaryVec) Delete(labels map[string]string) bool {
}
return v.SummaryVec.Delete(labels)
}

// Reset deletes all metrics in this vector.
func (v *SummaryVec) Reset() {
if !v.IsCreated() {
return
}

v.SummaryVec.Reset()
}

0 comments on commit 63a5cb3

Please sign in to comment.