Merge pull request #11858 from fayzal-g/fix-chunks-metrics

tsdb: when reading WAL, correctly update chunksRemoved and chunks metrics
This commit is contained in:
Ganesh Vernekar 2023-01-30 19:45:12 +05:30 committed by GitHub
commit 8e8b718365
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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