From 9412b296d5f9464cd46a4d628d2248c3477b1265 Mon Sep 17 00:00:00 2001 From: Julius Volz Date: Sun, 1 Feb 2015 12:47:51 +0100 Subject: [PATCH] Remove labels on persist error counter. This fixes https://github.com/prometheus/prometheus/issues/496 --- storage/local/storage.go | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/storage/local/storage.go b/storage/local/storage.go index e778bf915..534b9cdc9 100644 --- a/storage/local/storage.go +++ b/storage/local/storage.go @@ -81,7 +81,7 @@ type memorySeriesStorage struct { evictStopping, evictStopped chan struct{} persistLatency prometheus.Summary - persistErrors *prometheus.CounterVec + persistErrors prometheus.Counter persistQueueLength prometheus.Gauge numSeries prometheus.Gauge seriesOps *prometheus.CounterVec @@ -151,15 +151,12 @@ func NewMemorySeriesStorage(o *MemorySeriesStorageOptions) (Storage, error) { Name: "persist_latency_microseconds", Help: "A summary of latencies for persisting each chunk.", }), - persistErrors: prometheus.NewCounterVec( - prometheus.CounterOpts{ - Namespace: namespace, - Subsystem: subsystem, - Name: "persist_errors_total", - Help: "A counter of errors persisting chunks.", - }, - []string{"error"}, - ), + persistErrors: prometheus.NewCounter(prometheus.CounterOpts{ + Namespace: namespace, + Subsystem: subsystem, + Name: "persist_errors_total", + Help: "The total number of errors while persisting chunks.", + }), persistQueueLength: prometheus.NewGauge(prometheus.GaugeOpts{ Namespace: namespace, Subsystem: subsystem, @@ -536,7 +533,7 @@ func (s *memorySeriesStorage) handlePersistQueue() { s.fpLocker.Unlock(req.fingerprint) s.persistLatency.Observe(float64(time.Since(start)) / float64(time.Microsecond)) if err != nil { - s.persistErrors.WithLabelValues(err.Error()).Inc() + s.persistErrors.Inc() glog.Error("Error persisting chunk: ", err) s.persistence.setDirty(true) continue @@ -857,7 +854,7 @@ func (s *memorySeriesStorage) Describe(ch chan<- *prometheus.Desc) { s.persistence.Describe(ch) ch <- s.persistLatency.Desc() - s.persistErrors.Describe(ch) + ch <- s.persistErrors.Desc() ch <- s.persistQueueLength.Desc() ch <- s.numSeries.Desc() s.seriesOps.Describe(ch) @@ -874,7 +871,7 @@ func (s *memorySeriesStorage) Collect(ch chan<- prometheus.Metric) { s.persistence.Collect(ch) ch <- s.persistLatency - s.persistErrors.Collect(ch) + ch <- s.persistErrors ch <- s.persistQueueLength ch <- s.numSeries s.seriesOps.Collect(ch)