mirror of
https://github.com/grafana/grafana.git
synced 2024-12-02 13:39:19 -06:00
fd633a1d5d
This way we are able to edit notification behavior per notifier. This would be usefull to let some notifiers send notifications, even when the state doesn't change, or with custom condition. Signed-off-by: Thibault Chataigner <t.chataigner@criteo.com>
46 lines
782 B
Go
46 lines
782 B
Go
package alerting
|
|
|
|
import "time"
|
|
|
|
type EvalHandler interface {
|
|
Eval(evalContext *EvalContext)
|
|
}
|
|
|
|
type Scheduler interface {
|
|
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
|
|
}
|
|
|
|
type Condition interface {
|
|
Eval(result *EvalContext) (*ConditionResult, error)
|
|
}
|