Scraping: drop series cache when resizing symbol table

Clear caches by restarting scraping loops: each loop assumes it has
exclusive ownership of its cache, so we can't come in from another
goroutine and change it.

Signed-off-by: Bryan Boreham <bjboreham@gmail.com>
This commit is contained in:
Bryan Boreham 2024-04-02 17:07:00 +01:00
parent 74b1f3daa6
commit e6356e64bd

View File

@ -376,6 +376,7 @@ func (sp *scrapePool) checkSymbolTable() {
} else if sp.symbolTable.Len() > 2*sp.initialSymbolTableLen {
sp.symbolTable = labels.NewSymbolTable()
sp.initialSymbolTableLen = 0
sp.restartLoops(false) // To drop all caches.
}
sp.lastSymbolTableCheck = time.Now()
}