From 10c55533cbba5e38cdf9a13aadeb0bddffcd08d2 Mon Sep 17 00:00:00 2001 From: beorn7 Date: Tue, 29 Aug 2017 14:51:49 +0200 Subject: [PATCH] Rename the receiver of `...Vec` methods from `m` to `v` --- prometheus/counter.go | 16 ++++++++-------- prometheus/gauge.go | 16 ++++++++-------- prometheus/histogram.go | 16 ++++++++-------- prometheus/summary.go | 16 ++++++++-------- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/prometheus/counter.go b/prometheus/counter.go index 07f99f4..d92e42e 100644 --- a/prometheus/counter.go +++ b/prometheus/counter.go @@ -119,8 +119,8 @@ func NewCounterVec(opts CounterOpts, labelNames []string) *CounterVec { // latter has a much more readable (albeit more verbose) syntax, but it comes // with a performance overhead (for creating and processing the Labels map). // See also the GaugeVec example. -func (m *CounterVec) GetMetricWithLabelValues(lvs ...string) (Counter, error) { - metric, err := m.metricVec.getMetricWithLabelValues(lvs...) +func (v *CounterVec) GetMetricWithLabelValues(lvs ...string) (Counter, error) { + metric, err := v.metricVec.getMetricWithLabelValues(lvs...) if metric != nil { return metric.(Counter), err } @@ -139,8 +139,8 @@ func (m *CounterVec) GetMetricWithLabelValues(lvs ...string) (Counter, error) { // This method is used for the same purpose as // GetMetricWithLabelValues(...string). See there for pros and cons of the two // methods. -func (m *CounterVec) GetMetricWith(labels Labels) (Counter, error) { - metric, err := m.metricVec.getMetricWith(labels) +func (v *CounterVec) GetMetricWith(labels Labels) (Counter, error) { + metric, err := v.metricVec.getMetricWith(labels) if metric != nil { return metric.(Counter), err } @@ -151,8 +151,8 @@ func (m *CounterVec) GetMetricWith(labels Labels) (Counter, error) { // GetMetricWithLabelValues would have returned an error. By not returning an // error, WithLabelValues allows shortcuts like // myVec.WithLabelValues("404", "GET").Add(42) -func (m *CounterVec) WithLabelValues(lvs ...string) Counter { - c, err := m.GetMetricWithLabelValues(lvs...) +func (v *CounterVec) WithLabelValues(lvs ...string) Counter { + c, err := v.GetMetricWithLabelValues(lvs...) if err != nil { panic(err) } @@ -162,8 +162,8 @@ func (m *CounterVec) WithLabelValues(lvs ...string) Counter { // With works as GetMetricWith, but panics where GetMetricWithLabels would have // returned an error. By not returning an error, With allows shortcuts like // myVec.With(Labels{"code": "404", "method": "GET"}).Add(42) -func (m *CounterVec) With(labels Labels) Counter { - c, err := m.GetMetricWith(labels) +func (v *CounterVec) With(labels Labels) Counter { + c, err := v.GetMetricWith(labels) if err != nil { panic(err) } diff --git a/prometheus/gauge.go b/prometheus/gauge.go index a0cacec..5084b3e 100644 --- a/prometheus/gauge.go +++ b/prometheus/gauge.go @@ -105,8 +105,8 @@ func NewGaugeVec(opts GaugeOpts, labelNames []string) *GaugeVec { // an alternative to avoid that type of mistake. For higher label numbers, the // latter has a much more readable (albeit more verbose) syntax, but it comes // with a performance overhead (for creating and processing the Labels map). -func (m *GaugeVec) GetMetricWithLabelValues(lvs ...string) (Gauge, error) { - metric, err := m.metricVec.getMetricWithLabelValues(lvs...) +func (v *GaugeVec) GetMetricWithLabelValues(lvs ...string) (Gauge, error) { + metric, err := v.metricVec.getMetricWithLabelValues(lvs...) if metric != nil { return metric.(Gauge), err } @@ -125,8 +125,8 @@ func (m *GaugeVec) GetMetricWithLabelValues(lvs ...string) (Gauge, error) { // This method is used for the same purpose as // GetMetricWithLabelValues(...string). See there for pros and cons of the two // methods. -func (m *GaugeVec) GetMetricWith(labels Labels) (Gauge, error) { - metric, err := m.metricVec.getMetricWith(labels) +func (v *GaugeVec) GetMetricWith(labels Labels) (Gauge, error) { + metric, err := v.metricVec.getMetricWith(labels) if metric != nil { return metric.(Gauge), err } @@ -137,8 +137,8 @@ func (m *GaugeVec) GetMetricWith(labels Labels) (Gauge, error) { // GetMetricWithLabelValues would have returned an error. By not returning an // error, WithLabelValues allows shortcuts like // myVec.WithLabelValues("404", "GET").Add(42) -func (m *GaugeVec) WithLabelValues(lvs ...string) Gauge { - g, err := m.GetMetricWithLabelValues(lvs...) +func (v *GaugeVec) WithLabelValues(lvs ...string) Gauge { + g, err := v.GetMetricWithLabelValues(lvs...) if err != nil { panic(err) } @@ -148,8 +148,8 @@ func (m *GaugeVec) WithLabelValues(lvs ...string) Gauge { // With works as GetMetricWith, but panics where GetMetricWithLabels would have // returned an error. By not returning an error, With allows shortcuts like // myVec.With(Labels{"code": "404", "method": "GET"}).Add(42) -func (m *GaugeVec) With(labels Labels) Gauge { - g, err := m.GetMetricWith(labels) +func (v *GaugeVec) With(labels Labels) Gauge { + g, err := v.GetMetricWith(labels) if err != nil { panic(err) } diff --git a/prometheus/histogram.go b/prometheus/histogram.go index 1b2d9b4..c68929a 100644 --- a/prometheus/histogram.go +++ b/prometheus/histogram.go @@ -330,8 +330,8 @@ func NewHistogramVec(opts HistogramOpts, labelNames []string) *HistogramVec { // latter has a much more readable (albeit more verbose) syntax, but it comes // with a performance overhead (for creating and processing the Labels map). // See also the GaugeVec example. -func (m *HistogramVec) GetMetricWithLabelValues(lvs ...string) (Observer, error) { - metric, err := m.metricVec.getMetricWithLabelValues(lvs...) +func (v *HistogramVec) GetMetricWithLabelValues(lvs ...string) (Observer, error) { + metric, err := v.metricVec.getMetricWithLabelValues(lvs...) if metric != nil { return metric.(Observer), err } @@ -350,8 +350,8 @@ func (m *HistogramVec) GetMetricWithLabelValues(lvs ...string) (Observer, error) // This method is used for the same purpose as // GetMetricWithLabelValues(...string). See there for pros and cons of the two // methods. -func (m *HistogramVec) GetMetricWith(labels Labels) (Observer, error) { - metric, err := m.metricVec.getMetricWith(labels) +func (v *HistogramVec) GetMetricWith(labels Labels) (Observer, error) { + metric, err := v.metricVec.getMetricWith(labels) if metric != nil { return metric.(Observer), err } @@ -362,8 +362,8 @@ func (m *HistogramVec) GetMetricWith(labels Labels) (Observer, error) { // GetMetricWithLabelValues would have returned an error. By not returning an // error, WithLabelValues allows shortcuts like // myVec.WithLabelValues("404", "GET").Observe(42.21) -func (m *HistogramVec) WithLabelValues(lvs ...string) Observer { - h, err := m.GetMetricWithLabelValues(lvs...) +func (v *HistogramVec) WithLabelValues(lvs ...string) Observer { + h, err := v.GetMetricWithLabelValues(lvs...) if err != nil { panic(err) } @@ -373,8 +373,8 @@ func (m *HistogramVec) WithLabelValues(lvs ...string) Observer { // With works as GetMetricWith, but panics where GetMetricWithLabels would have // returned an error. By not returning an error, With allows shortcuts like // myVec.With(Labels{"code": "404", "method": "GET"}).Observe(42.21) -func (m *HistogramVec) With(labels Labels) Observer { - h, err := m.GetMetricWith(labels) +func (v *HistogramVec) With(labels Labels) Observer { + h, err := v.GetMetricWith(labels) if err != nil { panic(err) } diff --git a/prometheus/summary.go b/prometheus/summary.go index b075301..2db5283 100644 --- a/prometheus/summary.go +++ b/prometheus/summary.go @@ -447,8 +447,8 @@ func NewSummaryVec(opts SummaryOpts, labelNames []string) *SummaryVec { // latter has a much more readable (albeit more verbose) syntax, but it comes // with a performance overhead (for creating and processing the Labels map). // See also the GaugeVec example. -func (m *SummaryVec) GetMetricWithLabelValues(lvs ...string) (Observer, error) { - metric, err := m.metricVec.getMetricWithLabelValues(lvs...) +func (v *SummaryVec) GetMetricWithLabelValues(lvs ...string) (Observer, error) { + metric, err := v.metricVec.getMetricWithLabelValues(lvs...) if metric != nil { return metric.(Observer), err } @@ -467,8 +467,8 @@ func (m *SummaryVec) GetMetricWithLabelValues(lvs ...string) (Observer, error) { // This method is used for the same purpose as // GetMetricWithLabelValues(...string). See there for pros and cons of the two // methods. -func (m *SummaryVec) GetMetricWith(labels Labels) (Observer, error) { - metric, err := m.metricVec.getMetricWith(labels) +func (v *SummaryVec) GetMetricWith(labels Labels) (Observer, error) { + metric, err := v.metricVec.getMetricWith(labels) if metric != nil { return metric.(Observer), err } @@ -479,8 +479,8 @@ func (m *SummaryVec) GetMetricWith(labels Labels) (Observer, error) { // GetMetricWithLabelValues would have returned an error. By not returning an // error, WithLabelValues allows shortcuts like // myVec.WithLabelValues("404", "GET").Observe(42.21) -func (m *SummaryVec) WithLabelValues(lvs ...string) Observer { - s, err := m.GetMetricWithLabelValues(lvs...) +func (v *SummaryVec) WithLabelValues(lvs ...string) Observer { + s, err := v.GetMetricWithLabelValues(lvs...) if err != nil { panic(err) } @@ -490,8 +490,8 @@ func (m *SummaryVec) WithLabelValues(lvs ...string) Observer { // With works as GetMetricWith, but panics where GetMetricWithLabels would have // returned an error. By not returning an error, With allows shortcuts like // myVec.With(Labels{"code": "404", "method": "GET"}).Observe(42.21) -func (m *SummaryVec) With(labels Labels) Observer { - s, err := m.GetMetricWith(labels) +func (v *SummaryVec) With(labels Labels) Observer { + s, err := v.GetMetricWith(labels) if err != nil { panic(err) }