Add metrics to ngalert scheduler (#44602)

This pull request adds metrics to the ngalert scheduler so we can see how long it takes to evaluate a tick.
This commit is contained in:
George Robinson
2022-01-31 16:56:43 +00:00
committed by GitHub
parent 793e3d3556
commit 5e2280ceee
5 changed files with 99 additions and 68 deletions
+8 -1
View File
@@ -1,10 +1,17 @@
package schedule
import (
"time"
"github.com/grafana/grafana/pkg/services/ngalert/models"
)
func (sch *schedule) fetchAllDetails(disabledOrgs []int64) []*models.AlertRule {
func (sch *schedule) getAlertRules(disabledOrgs []int64) []*models.AlertRule {
start := time.Now()
defer func() {
sch.metrics.GetAlertRulesDuration.Observe(time.Since(start).Seconds())
}()
q := models.ListAlertRulesQuery{
ExcludeOrgs: disabledOrgs,
}