dummie_executor.go 428 B

1234567891011121314151617181920
  1. package alerting
  2. import (
  3. "github.com/grafana/grafana/pkg/log"
  4. m "github.com/grafana/grafana/pkg/models"
  5. "time"
  6. )
  7. type DummieExecutor struct{}
  8. func (this *DummieExecutor) Execute(rule m.AlertRule, responseQueue chan *m.AlertResult) {
  9. if rule.Id%3 == 0 {
  10. time.Sleep(time.Second * 1)
  11. }
  12. time.Sleep(time.Second)
  13. log.Info("Finnished executing: %d", rule.Id)
  14. responseQueue <- &m.AlertResult{State: "OK", Id: rule.Id}
  15. }