From eb5034d5b0c54651beee345590b17a1040d67f9c Mon Sep 17 00:00:00 2001 From: radek_lesniewski Date: Tue, 29 Jan 2019 12:23:53 +0100 Subject: [PATCH] Additional logging in compact.go - logged time needed for writing blocks (#505) * Additional logging in compact.go - logged time needed for writing blocks to disk Signed-off-by: Radoslaw Lesniewski * Additional logging in compact.go - code formatted Signed-off-by: Radoslaw Lesniewski --- compact.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/compact.go b/compact.go index 5d8155f51..0358a8006 100644 --- a/compact.go +++ b/compact.go @@ -414,6 +414,8 @@ func (c *LeveledCompactor) Compact(dest string, dirs []string, open []*Block) (u } func (c *LeveledCompactor) Write(dest string, b BlockReader, mint, maxt int64, parent *BlockMeta) (ulid.ULID, error) { + start := time.Now() + entropy := rand.New(rand.NewSource(time.Now().UnixNano())) uid := ulid.MustNew(ulid.Now(), entropy) @@ -440,7 +442,13 @@ func (c *LeveledCompactor) Write(dest string, b BlockReader, mint, maxt int64, p return ulid.ULID{}, nil } - level.Info(c.logger).Log("msg", "write block", "mint", meta.MinTime, "maxt", meta.MaxTime, "ulid", meta.ULID) + level.Info(c.logger).Log( + "msg", "write block", + "mint", meta.MinTime, + "maxt", meta.MaxTime, + "ulid", meta.ULID, + "duration", time.Since(start), + ) return uid, nil }