diff --git a/prometheus/counter.go b/prometheus/counter.go index 765e455..3a88622 100644 --- a/prometheus/counter.go +++ b/prometheus/counter.go @@ -154,7 +154,7 @@ func NewCounterVec(opts CounterOpts, labelNames []string) *CounterVec { // SummaryVec example. // // Keeping the Counter for later use is possible (and should be considered if -// performance is critical), but keep in mind that Reset, DeleteLabelValues and +// performance is critical), but keep in mind that Clear, DeleteLabelValues and // Delete can be used to delete the Counter from the CounterVec. In that case, // the Counter will still exist, but it will not be exported anymore, even if a // Counter with the same label values is created later. @@ -230,7 +230,7 @@ func (v *CounterVec) With(labels Labels) Counter { // The metrics contained in the CounterVec are shared between the curried and // uncurried vectors. They are just accessed differently. Curried and uncurried // vectors behave identically in terms of collection. Only one must be -// registered with a given registry (usually the uncurried version). The Reset +// registered with a given registry (usually the uncurried version). The Clear // method deletes all metrics, even if called on a curried vector. func (v *CounterVec) CurryWith(labels Labels) (*CounterVec, error) { vec, err := v.curryWith(labels) diff --git a/prometheus/histogram.go b/prometheus/histogram.go index 4d7fa97..73f8d28 100644 --- a/prometheus/histogram.go +++ b/prometheus/histogram.go @@ -414,7 +414,7 @@ func NewHistogramVec(opts HistogramOpts, labelNames []string) *HistogramVec { // any observations. // // Keeping the Histogram for later use is possible (and should be considered if -// performance is critical), but keep in mind that Reset, DeleteLabelValues and +// performance is critical), but keep in mind that Clear, DeleteLabelValues and // Delete can be used to delete the Histogram from the HistogramVec. In that case, the // Histogram will still exist, but it will not be exported anymore, even if a // Histogram with the same label values is created later. See also the CounterVec @@ -491,7 +491,7 @@ func (v *HistogramVec) With(labels Labels) Observer { // The metrics contained in the HistogramVec are shared between the curried and // uncurried vectors. They are just accessed differently. Curried and uncurried // vectors behave identically in terms of collection. Only one must be -// registered with a given registry (usually the uncurried version). The Reset +// registered with a given registry (usually the uncurried version). The Clear // method deletes all metrics, even if called on a curried vector. func (v *HistogramVec) CurryWith(labels Labels) (ObserverVec, error) { vec, err := v.curryWith(labels) diff --git a/prometheus/summary.go b/prometheus/summary.go index c1475aa..5eb6061 100644 --- a/prometheus/summary.go +++ b/prometheus/summary.go @@ -426,7 +426,7 @@ func NewSummaryVec(opts SummaryOpts, labelNames []string) *SummaryVec { // any observations. // // Keeping the Summary for later use is possible (and should be considered if -// performance is critical), but keep in mind that Reset, DeleteLabelValues and +// performance is critical), but keep in mind that Clear, DeleteLabelValues and // Delete can be used to delete the Summary from the SummaryVec. In that case, // the Summary will still exist, but it will not be exported anymore, even if a // Summary with the same label values is created later. See also the CounterVec @@ -503,7 +503,7 @@ func (v *SummaryVec) With(labels Labels) Observer { // The metrics contained in the SummaryVec are shared between the curried and // uncurried vectors. They are just accessed differently. Curried and uncurried // vectors behave identically in terms of collection. Only one must be -// registered with a given registry (usually the uncurried version). The Reset +// registered with a given registry (usually the uncurried version). The Clear // method deletes all metrics, even if called on a curried vector. func (v *SummaryVec) CurryWith(labels Labels) (ObserverVec, error) { vec, err := v.curryWith(labels) diff --git a/prometheus/vec.go b/prometheus/vec.go index 14ed9e8..6c4caaa 100644 --- a/prometheus/vec.go +++ b/prometheus/vec.go @@ -234,8 +234,8 @@ func (m *metricMap) Collect(ch chan<- Metric) { } } -// Reset deletes all metrics in this vector. -func (m *metricMap) Reset() { +// Clear deletes all metrics in this vector. +func (m *metricMap) Clear() { m.mtx.Lock() defer m.mtx.Unlock() diff --git a/prometheus/vec_test.go b/prometheus/vec_test.go index bd18a9f..f903d75 100644 --- a/prometheus/vec_test.go +++ b/prometheus/vec_test.go @@ -150,7 +150,7 @@ func TestMetricVecWithCollisions(t *testing.T) { } func testMetricVec(t *testing.T, vec *GaugeVec) { - vec.Reset() // Actually test Reset now! + vec.Clear() // Actually test Clear now! var pair [2]string // Keep track of metrics. @@ -199,7 +199,7 @@ func testMetricVec(t *testing.T, vec *GaugeVec) { t.Fatalf("unexpected number of metrics: %v != %v", total, len(expected)) } - vec.Reset() + vec.Clear() if len(vec.metricMap.metrics) > 0 { t.Fatalf("reset failed")