From f32307b656976203836f691eab70d4c0544f1744 Mon Sep 17 00:00:00 2001 From: Harkishen Singh Date: Sun, 5 Jul 2020 11:25:42 +0530 Subject: [PATCH] Increments WAL corruption metric on WAL corruption during checkpointing (#7491) * Increments wal corruption metric on error during checkpointing Signed-off-by: Harkishen-Singh * check for wal corruption error Signed-off-by: Harkishen-Singh --- tsdb/head.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tsdb/head.go b/tsdb/head.go index f02ef767f0..3b1d4ad057 100644 --- a/tsdb/head.go +++ b/tsdb/head.go @@ -837,6 +837,9 @@ func (h *Head) Truncate(mint int64) (err error) { h.metrics.checkpointCreationTotal.Inc() if _, err = wal.Checkpoint(h.wal, first, last, keep, mint); err != nil { h.metrics.checkpointCreationFail.Inc() + if _, ok := errors.Cause(err).(*wal.CorruptionErr); ok { + h.metrics.walCorruptionsTotal.Inc() + } return errors.Wrap(err, "create checkpoint") } if err := h.wal.Truncate(last + 1); err != nil {