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
4619a05f
Commit
4619a05f
authored
Aug 31, 2016
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(alerting): save execution error message to annotations
parent
c624f3d4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
2 deletions
+5
-2
pkg/services/alerting/result_handler.go
+4
-1
pkg/tsdb/graphite/graphite.go
+1
-1
No files found.
pkg/services/alerting/result_handler.go
View file @
4619a05f
...
...
@@ -31,12 +31,15 @@ func (handler *DefaultResultHandler) Handle(ctx *EvalContext) {
oldState
:=
ctx
.
Rule
.
State
exeuctionError
:=
""
annotationData
:=
simplejson
.
New
()
if
ctx
.
Error
!=
nil
{
handler
.
log
.
Error
(
"Alert Rule Result Error"
,
"ruleId"
,
ctx
.
Rule
.
Id
,
"error"
,
ctx
.
Error
)
ctx
.
Rule
.
State
=
m
.
AlertStateExeuctionError
exeuctionError
=
ctx
.
Error
.
Error
()
annotationData
.
Set
(
"errorMessage"
,
exeuctionError
)
}
else
if
ctx
.
Firing
{
ctx
.
Rule
.
State
=
m
.
AlertStateType
(
ctx
.
Rule
.
Severity
)
annotationData
=
simplejson
.
NewFromAny
(
ctx
.
EvalMatches
)
}
else
{
ctx
.
Rule
.
State
=
m
.
AlertStateOK
}
...
...
@@ -66,7 +69,7 @@ func (handler *DefaultResultHandler) Handle(ctx *EvalContext) {
NewState
:
string
(
ctx
.
Rule
.
State
),
PrevState
:
string
(
oldState
),
Timestamp
:
time
.
Now
(),
Data
:
simplejson
.
NewFromAny
(
ctx
.
EvalMatches
)
,
Data
:
annotationData
,
}
annotationRepo
:=
annotations
.
GetRepository
()
...
...
pkg/tsdb/graphite/graphite.go
View file @
4619a05f
...
...
@@ -49,12 +49,12 @@ func (e *GraphiteExecutor) Execute(queries tsdb.QuerySlice, context *tsdb.QueryC
}
res
,
err
:=
client
.
Do
(
req
)
defer
res
.
Body
.
Close
()
if
err
!=
nil
{
result
.
Error
=
err
return
result
}
defer
res
.
Body
.
Close
()
body
,
err
:=
ioutil
.
ReadAll
(
res
.
Body
)
if
err
!=
nil
{
result
.
Error
=
err
...
...
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