Add Reset() API to stability framework

This commit is contained in:
RainbowMango 2019-11-13 19:52:40 +08:00
parent eedfb6bc7a
commit ea40540f5c
4 changed files with 36 additions and 0 deletions

View File

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

View File

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

View File

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

View File

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