From 3e17cd162137cf8dda9a00465c5221013a736a94 Mon Sep 17 00:00:00 2001 From: Simon Pasquier Date: Fri, 6 Oct 2017 13:50:20 +0200 Subject: [PATCH] Instrument WAL corruptions --- wal.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wal.go b/wal.go index 467c4e09be..1a7f9c25d6 100644 --- a/wal.go +++ b/wal.go @@ -68,6 +68,7 @@ type DeletesCB func([]Stone) error type walMetrics struct { fsyncDuration prometheus.Summary + corruptions prometheus.Counter } func newWalMetrics(wal *SegmentWAL, r prometheus.Registerer) *walMetrics { @@ -77,10 +78,15 @@ func newWalMetrics(wal *SegmentWAL, r prometheus.Registerer) *walMetrics { Name: "tsdb_wal_fsync_duration_seconds", Help: "Duration of WAL fsync.", }) + m.corruptions = prometheus.NewCounter(prometheus.CounterOpts{ + Name: "tsdb_wal_corruptions_total", + Help: "Total number of WAL corruptions.", + }) if r != nil { r.MustRegister( m.fsyncDuration, + m.corruptions, ) } return m @@ -247,6 +253,7 @@ func (r *repairingWALReader) Read(series SeriesCB, samples SamplesCB, deletes De if !ok { return err } + r.wal.metrics.corruptions.Inc() return r.wal.truncate(cerr.err, cerr.file, cerr.lastOffset) }