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
e78da57e
Commit
e78da57e
authored
Jan 16, 2017
by
bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(alerting): shows when no_data triggered alerts
closes #7035 ref #7257
parent
f29f83ca
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
29 additions
and
7 deletions
+29
-7
pkg/api/alerting.go
+1
-0
pkg/api/dtos/alerting.go
+1
-0
pkg/services/alerting/result_handler.go
+6
-2
pkg/services/sqlstore/alert.go
+6
-0
public/app/features/alerting/alert_list_ctrl.ts
+3
-0
public/app/features/alerting/alert_tab_ctrl.ts
+9
-0
public/app/features/alerting/partials/alert_list.html
+3
-5
No files found.
pkg/api/alerting.go
View file @
e78da57e
...
...
@@ -75,6 +75,7 @@ func GetAlerts(c *middleware.Context) Response {
State
:
alert
.
State
,
NewStateDate
:
alert
.
NewStateDate
,
ExecutionError
:
alert
.
ExecutionError
,
EvalData
:
alert
.
EvalData
,
})
}
...
...
pkg/api/dtos/alerting.go
View file @
e78da57e
...
...
@@ -17,6 +17,7 @@ type AlertRule struct {
State
m
.
AlertStateType
`json:"state"`
NewStateDate
time
.
Time
`json:"newStateDate"`
EvalDate
time
.
Time
`json:"evalDate"`
EvalData
*
simplejson
.
Json
`json:"evalData"`
ExecutionError
string
`json:"executionError"`
DashbboardUri
string
`json:"dashboardUri"`
}
...
...
pkg/services/alerting/result_handler.go
View file @
e78da57e
...
...
@@ -31,13 +31,17 @@ func (handler *DefaultResultHandler) Handle(evalContext *EvalContext) error {
executionError
:=
""
annotationData
:=
simplejson
.
New
()
if
evalContext
.
Firing
{
annotationData
=
simplejson
.
NewFromAny
(
evalContext
.
EvalMatches
)
}
if
evalContext
.
Error
!=
nil
{
executionError
=
evalContext
.
Error
.
Error
()
annotationData
.
Set
(
"errorMessage"
,
executionError
)
}
if
evalContext
.
Firing
{
annotationData
=
simplejson
.
NewFromAny
(
evalContext
.
EvalMatches
)
if
evalContext
.
NoDataFound
{
annotationData
.
Set
(
"no_data"
,
true
)
}
countStateResult
(
evalContext
.
Rule
.
State
)
...
...
pkg/services/sqlstore/alert.go
View file @
e78da57e
...
...
@@ -113,6 +113,12 @@ func HandleAlertsQuery(query *m.GetAlertsQuery) error {
return
err
}
for
i
,
_
:=
range
alerts
{
if
alerts
[
i
]
.
ExecutionError
==
" "
{
alerts
[
i
]
.
ExecutionError
=
""
}
}
query
.
Result
=
alerts
return
nil
}
...
...
public/app/features/alerting/alert_list_ctrl.ts
View file @
e78da57e
...
...
@@ -37,6 +37,9 @@ export class AlertListCtrl {
this
.
alerts
=
_
.
map
(
result
,
alert
=>
{
alert
.
stateModel
=
alertDef
.
getStateDisplayModel
(
alert
.
state
);
alert
.
newStateDateAgo
=
moment
(
alert
.
newStateDate
).
fromNow
().
replace
(
" ago"
,
""
);
if
(
alert
.
evalData
&&
alert
.
evalData
.
no_data
)
{
alert
.
no_data
=
true
;
}
return
alert
;
});
});
...
...
public/app/features/alerting/alert_tab_ctrl.ts
View file @
e78da57e
...
...
@@ -82,6 +82,15 @@ export class AlertTabCtrl {
ah
.
time
=
moment
(
ah
.
time
).
format
(
'MMM D, YYYY HH:mm:ss'
);
ah
.
stateModel
=
alertDef
.
getStateDisplayModel
(
ah
.
newState
);
ah
.
metrics
=
alertDef
.
joinEvalMatches
(
ah
.
data
,
', '
);
if
(
ah
.
data
.
errorMessage
)
{
ah
.
metrics
=
"Error: "
+
ah
.
data
.
errorMessage
;
}
if
(
ah
.
data
.
no_data
)
{
ah
.
metrics
=
"(due to no data)"
;
}
return
ah
;
});
});
...
...
public/app/features/alerting/partials/alert_list.html
View file @
e78da57e
...
...
@@ -52,11 +52,11 @@
<div
class=
"card-item-sub-name"
>
<span
class=
"alert-list-item-state {{alert.stateModel.stateClass}}"
>
<i
class=
"{{alert.stateModel.iconClass}}"
></i>
{{alert.stateModel.text}}
{{alert.stateModel.text}}
<span
class=
"small muted"
ng-show=
"alert.no_data"
>
(due to no data)
</span>
</span>
for {{alert.newStateDateAgo}}
</div>
<div
class=
"small muted"
ng-show=
"alert.executionError"
>
{{alert.executionError}}
<div
class=
"small muted"
ng-show=
"alert.executionError
!== ''
"
>
Error: "{{alert.executionError}}"
</div>
</div>
</div>
...
...
@@ -64,6 +64,4 @@
</li>
</ol>
</section>
</div>
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