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()