mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
tech(alerting): remove unused code
This commit is contained in:
@@ -26,7 +26,6 @@ type EvalContext struct {
|
|||||||
ImagePublicUrl string
|
ImagePublicUrl string
|
||||||
ImageOnDiskPath string
|
ImageOnDiskPath string
|
||||||
NoDataFound bool
|
NoDataFound bool
|
||||||
RetryCount int
|
|
||||||
|
|
||||||
Ctx context.Context
|
Ctx context.Context
|
||||||
}
|
}
|
||||||
@@ -107,6 +106,5 @@ func NewEvalContext(alertCtx context.Context, rule *Rule) *EvalContext {
|
|||||||
Logs: make([]*ResultLogEntry, 0),
|
Logs: make([]*ResultLogEntry, 0),
|
||||||
EvalMatches: make([]*EvalMatch, 0),
|
EvalMatches: make([]*EvalMatch, 0),
|
||||||
log: log.New("alerting.evalContext"),
|
log: log.New("alerting.evalContext"),
|
||||||
RetryCount: 0,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
package notifiers
|
|
||||||
|
|
||||||
// import . "github.com/smartystreets/goconvey/convey"
|
|
||||||
//
|
|
||||||
// func TestBaseNotifier( t *testing.T ) {
|
|
||||||
// Convey("Parsing base notification state", t, func() {
|
|
||||||
//
|
|
||||||
// Convey("matches", func() {
|
|
||||||
// json := `
|
|
||||||
// {
|
|
||||||
// "states": "critical"
|
|
||||||
// }`
|
|
||||||
//
|
|
||||||
// settingsJSON, _ := simplejson.NewJson([]byte(json))
|
|
||||||
// not := NewNotifierBase("ops", "email", settingsJSON)
|
|
||||||
// So(not.MatchSeverity(m.AlertSeverityCritical), ShouldBeTrue)
|
|
||||||
// })
|
|
||||||
//
|
|
||||||
// Convey("does not match", func() {
|
|
||||||
// json := `
|
|
||||||
// {
|
|
||||||
// "severityFilter": "critical"
|
|
||||||
// }`
|
|
||||||
//
|
|
||||||
// settingsJSON, _ := simplejson.NewJson([]byte(json))
|
|
||||||
// not := NewNotifierBase("ops", "email", settingsJSON)
|
|
||||||
// So(not.MatchSeverity(m.AlertSeverityWarning), ShouldBeFalse)
|
|
||||||
// })
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
package notifiers
|
package notifiers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/base64"
|
||||||
|
"io/ioutil"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/grafana/grafana/pkg/bus"
|
"github.com/grafana/grafana/pkg/bus"
|
||||||
@@ -45,6 +47,14 @@ func (this *EmailNotifier) Notify(evalContext *alerting.EvalContext) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
imageLink := evalContext.ImagePublicUrl
|
||||||
|
if imageLink == "" {
|
||||||
|
imageBytes, err := ioutil.ReadFile(evalContext.ImageOnDiskPath)
|
||||||
|
if err == nil {
|
||||||
|
imageLink = "data:image/jpg;base64," + base64.StdEncoding.EncodeToString(imageBytes)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
cmd := &m.SendEmailCommandSync{
|
cmd := &m.SendEmailCommandSync{
|
||||||
SendEmailCommand: m.SendEmailCommand{
|
SendEmailCommand: m.SendEmailCommand{
|
||||||
Data: map[string]interface{}{
|
Data: map[string]interface{}{
|
||||||
|
|||||||
Reference in New Issue
Block a user