From 0cd0e16800f3248daf56227a27d91b305f1530f2 Mon Sep 17 00:00:00 2001 From: George Robinson Date: Thu, 25 Jul 2024 09:36:32 +0100 Subject: [PATCH] Fix defer --- pkg/ingester-rf1/flush.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/ingester-rf1/flush.go b/pkg/ingester-rf1/flush.go index 0e8185ee07310..aa22166d4fd3e 100644 --- a/pkg/ingester-rf1/flush.go +++ b/pkg/ingester-rf1/flush.go @@ -99,7 +99,7 @@ func (i *Ingester) flushSegment(ctx context.Context, j int, w *wal.SegmentWriter start := time.Now() i.metrics.flushesTotal.Add(1) - defer i.metrics.flushDuration.Observe(time.Since(start).Seconds()) + defer func() { i.metrics.flushDuration.Observe(time.Since(start).Seconds()) }() buf := i.flushBuffers[j] defer buf.Reset()