Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
ded5a0a9
Commit
ded5a0a9
authored
Oct 19, 2016
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tech(alerting): remove unused code
parent
206a6b0a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
32 deletions
+10
-32
pkg/services/alerting/eval_context.go
+0
-2
pkg/services/alerting/notifiers/base_test.go
+0
-30
pkg/services/alerting/notifiers/email.go
+10
-0
No files found.
pkg/services/alerting/eval_context.go
View file @
ded5a0a9
...
...
@@ -26,7 +26,6 @@ type EvalContext struct {
ImagePublicUrl
string
ImageOnDiskPath
string
NoDataFound
bool
RetryCount
int
Ctx
context
.
Context
}
...
...
@@ -107,6 +106,5 @@ func NewEvalContext(alertCtx context.Context, rule *Rule) *EvalContext {
Logs
:
make
([]
*
ResultLogEntry
,
0
),
EvalMatches
:
make
([]
*
EvalMatch
,
0
),
log
:
log
.
New
(
"alerting.evalContext"
),
RetryCount
:
0
,
}
}
pkg/services/alerting/notifiers/base_test.go
deleted
100644 → 0
View file @
206a6b0a
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)
// })
// })
// }
pkg/services/alerting/notifiers/email.go
View file @
ded5a0a9
package
notifiers
import
(
"encoding/base64"
"io/ioutil"
"strings"
"github.com/grafana/grafana/pkg/bus"
...
...
@@ -45,6 +47,14 @@ func (this *EmailNotifier) Notify(evalContext *alerting.EvalContext) error {
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
{
SendEmailCommand
:
m
.
SendEmailCommand
{
Data
:
map
[
string
]
interface
{}{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment