From 6fce45838a28f0d0d0802063d7a987b65e74d743 Mon Sep 17 00:00:00 2001 From: Yijie Qin <63399121+qinxx108@users.noreply.github.com> Date: Fri, 5 Nov 2021 15:26:29 -0700 Subject: [PATCH] Add access function for restoration state of alerting rule (#9665) --- rules/alerting.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/rules/alerting.go b/rules/alerting.go index 524d80afe..57cc252e1 100644 --- a/rules/alerting.go +++ b/rules/alerting.go @@ -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