Alerting: automatically remove stale alerting states (#36767)

* initial attempt at automatic removal of stale states

* test case, need espected states

* finish unit test

* PR feedback

* still multiply by time.second

* pr feedback
This commit is contained in:
David Parrott
2021-07-26 09:12:04 -07:00
committed by GitHub
parent 81b98745c0
commit b5f464412d
4 changed files with 151 additions and 1 deletions

View File

@@ -263,3 +263,9 @@ func mergeLabels(a, b data.Labels) data.Labels {
}
return newLbs
}
func (c *cache) deleteEntry(orgID int64, alertRuleUID, cacheID string) {
c.mtxStates.Lock()
defer c.mtxStates.Unlock()
delete(c.states[orgID][alertRuleUID], cacheID)
}