From cfa4ea53cc6a7355aedef68529bf80a81bed850b Mon Sep 17 00:00:00 2001 From: fayzal-g Date: Tue, 17 Jan 2023 15:42:19 +0000 Subject: [PATCH] Correctly update chunksRemoved and chunks metrics Signed-off-by: fayzal-g --- tsdb/head_wal.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tsdb/head_wal.go b/tsdb/head_wal.go index 708541364..f2ef4c1e0 100644 --- a/tsdb/head_wal.go +++ b/tsdb/head_wal.go @@ -498,6 +498,12 @@ func (h *Head) resetSeriesWithMMappedChunks(mSeries *memSeries, mmc, oooMmc []*m h.metrics.chunksCreated.Add(float64(len(mmc) + len(oooMmc))) h.metrics.chunksRemoved.Add(float64(len(mSeries.mmappedChunks))) h.metrics.chunks.Add(float64(len(mmc) + len(oooMmc) - len(mSeries.mmappedChunks))) + + if mSeries.ooo != nil { + h.metrics.chunksRemoved.Add(float64(len(mSeries.ooo.oooMmappedChunks))) + h.metrics.chunks.Sub(float64(len(mSeries.ooo.oooMmappedChunks))) + } + mSeries.mmappedChunks = mmc if len(oooMmc) == 0 { mSeries.ooo = nil