executor.go 501 B

12345678910111213141516171819202122
  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 Executor interface {
  8. Execute(rule m.AlertRule) (err error, result AlertResult)
  9. }
  10. type DummieExecutor struct{}
  11. func (this DummieExecutor) Execute(rule m.AlertRule) (err error, result AlertResult) {
  12. if rule.Id == 6 {
  13. time.Sleep(time.Second * 60)
  14. }
  15. time.Sleep(time.Second)
  16. log.Info("Finnished executing: %d", rule.Id)
  17. return nil, AlertResult{state: "OK", id: rule.Id}
  18. }