Add access function for restoration state of alerting rule (#9665)

pull/9880/head
Yijie Qin 2021-11-05 15:26:29 -07:00 committed by GitHub
parent b9c814fce6
commit 6fce45838a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -291,6 +291,13 @@ func (r *AlertingRule) SetRestored(restored bool) {
r.restored = restored
}
// Restored returns the restoration state of the alerting rule.
func (r *AlertingRule) Restored() bool {
r.mtx.Lock()
defer r.mtx.Unlock()
return r.restored
}
// resolvedRetention is the duration for which a resolved alert instance
// is kept in memory state and consequently repeatedly sent to the AlertManager.
const resolvedRetention = 15 * time.Minute