From c5cb5509eac3321cebe690e13ee7cbf9d20699f3 Mon Sep 17 00:00:00 2001 From: Yingnan Zhang <342144303@qq.com> Date: Mon, 15 Apr 2019 14:44:55 +0800 Subject: [PATCH] mvcc: fix db_compaction_total_duration_milliseconds --- mvcc/kvstore_compaction.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mvcc/kvstore_compaction.go b/mvcc/kvstore_compaction.go index d92dacd2396..b1fcac8a9a6 100644 --- a/mvcc/kvstore_compaction.go +++ b/mvcc/kvstore_compaction.go @@ -23,7 +23,7 @@ import ( func (s *store) scheduleCompaction(compactMainRev int64, keep map[revision]struct{}) bool { totalStart := time.Now() - defer dbCompactionTotalMs.Observe(float64(time.Since(totalStart) / time.Millisecond)) + defer func() { dbCompactionTotalMs.Observe(float64(time.Since(totalStart) / time.Millisecond)) }() keyCompactions := 0 defer func() { dbCompactionKeysCounter.Add(float64(keyCompactions)) }()