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
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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