Alerting: Remove dead evalRunning guard in rule routine (#88312)

Remove dead guard
This commit is contained in:
Alexander Weaver
2024-06-06 16:15:01 -05:00
committed by GitHub
parent 56bf666b0c
commit a2e21d61f8

View File

@@ -217,7 +217,6 @@ func (a *alertRule) Run(key ngmodels.AlertRuleKey) error {
logger := a.logger.FromContext(grafanaCtx) logger := a.logger.FromContext(grafanaCtx)
logger.Debug("Alert rule routine started") logger.Debug("Alert rule routine started")
evalRunning := false
var currentFingerprint fingerprint var currentFingerprint fingerprint
defer a.stopApplied(key) defer a.stopApplied(key)
for { for {
@@ -239,19 +238,14 @@ func (a *alertRule) Run(key ngmodels.AlertRuleKey) error {
logger.Debug("Evaluation channel has been closed. Exiting") logger.Debug("Evaluation channel has been closed. Exiting")
return nil return nil
} }
if evalRunning {
continue
}
func() { func() {
orgID := fmt.Sprint(key.OrgID) orgID := fmt.Sprint(key.OrgID)
evalDuration := a.metrics.EvalDuration.WithLabelValues(orgID) evalDuration := a.metrics.EvalDuration.WithLabelValues(orgID)
evalTotal := a.metrics.EvalTotal.WithLabelValues(orgID) evalTotal := a.metrics.EvalTotal.WithLabelValues(orgID)
evalRunning = true
evalStart := a.clock.Now() evalStart := a.clock.Now()
defer func() { defer func() {
evalRunning = false
a.evalApplied(key, ctx.scheduledAt) a.evalApplied(key, ctx.scheduledAt)
evalDuration.Observe(a.clock.Now().Sub(evalStart).Seconds()) evalDuration.Observe(a.clock.Now().Sub(evalStart).Seconds())
}() }()