From 2cc32c332d1ddf522ada0abe2691d908e91d5182 Mon Sep 17 00:00:00 2001 From: Ganesh Vernekar Date: Tue, 3 Mar 2020 19:41:14 +0530 Subject: [PATCH] Log WAL replay duration Signed-off-by: Ganesh Vernekar --- tsdb/head.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tsdb/head.go b/tsdb/head.go index e1eafcd302..856f720f1a 100644 --- a/tsdb/head.go +++ b/tsdb/head.go @@ -588,6 +588,7 @@ func (h *Head) Init(minValidTime int64) error { } level.Info(h.logger).Log("msg", "replaying WAL, this may take awhile") + start := time.Now() // Backfill the checkpoint first if it exists. dir, startFrom, err := wal.LastCheckpoint(h.wal.Dir()) if err != nil && err != record.ErrNotFound { @@ -638,6 +639,8 @@ func (h *Head) Init(minValidTime int64) error { level.Info(h.logger).Log("msg", "WAL segment loaded", "segment", i, "maxSegment", last) } + level.Info(h.logger).Log("msg", "WAL replay completed", "duration", time.Since(start).String()) + return nil }