Rename metric vector method `Reset` to `Clear`
This it to bring client_golang in line with the client library guidelines. See #218. Signed-off-by: beorn7 <beorn@soundcloud.com>
This commit is contained in:
parent
69a543ac3b
commit
f53420cd1d
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue