From 92ca322736dce77c5a748c32fe20561cbd5efa0e Mon Sep 17 00:00:00 2001 From: taisho6339 Date: Mon, 6 Sep 2021 00:09:58 +0900 Subject: [PATCH] Add 'loki_ingester_memory_chunks' when recovery from wal --- pkg/ingester/recovery.go | 1 + pkg/ingester/stream.go | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/ingester/recovery.go b/pkg/ingester/recovery.go index f572c595f4edb..efd47209f11b9 100644 --- a/pkg/ingester/recovery.go +++ b/pkg/ingester/recovery.go @@ -135,6 +135,7 @@ func (r *ingesterRecoverer) Series(series *Series) error { if err != nil { return err } + memoryChunks.Add(float64(len(series.Chunks))) r.ing.metrics.recoveredChunksTotal.Add(float64(len(series.Chunks))) r.ing.metrics.recoveredEntriesTotal.Add(float64(entriesAdded)) r.ing.replayController.Add(int64(bytesAdded)) diff --git a/pkg/ingester/stream.go b/pkg/ingester/stream.go index dee33325229b5..528c1eee2a26a 100644 --- a/pkg/ingester/stream.go +++ b/pkg/ingester/stream.go @@ -310,7 +310,10 @@ func (s *stream) Push( } }() } + } + if len(s.chunks) != prevNumChunks { + memoryChunks.Add(float64(len(s.chunks) - prevNumChunks)) } if len(failedEntriesWithError) > 0 { @@ -345,9 +348,6 @@ func (s *stream) Push( return bytesAdded, httpgrpc.Errorf(statusCode, buf.String()) } - if len(s.chunks) != prevNumChunks { - memoryChunks.Add(float64(len(s.chunks) - prevNumChunks)) - } return bytesAdded, nil }