grafana/pkg/services/alerting/interfaces.go

46 lines
782 B
Go
Raw Normal View History

package alerting
import "time"
2016-07-27 09:29:28 -05:00
type EvalHandler interface {
Eval(evalContext *EvalContext)
}
type Scheduler interface {
2016-07-27 09:29:28 -05:00
Tick(time time.Time, execQueue chan *Job)
Update(rules []*Rule)
}
type Notifier interface {
Notify(evalContext *EvalContext) error
GetType() string
NeedsImage() bool
ShouldNotify(evalContext *EvalContext) bool
GetNotifierId() int64
GetIsDefault() bool
}
type NotifierSlice []Notifier
func (notifiers NotifierSlice) ShouldUploadImage() bool {
for _, notifier := range notifiers {
if notifier.NeedsImage() {
return true
}
}
return false
}
type ConditionResult struct {
Firing bool
NoDataFound bool
Operator string
EvalMatches []*EvalMatch
}
2016-07-27 09:29:28 -05:00
type Condition interface {
Eval(result *EvalContext) (*ConditionResult, error)
}