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
388d3d37
Unverified
Commit
388d3d37
authored
Sep 05, 2019
by
Sofia Papagiannaki
Committed by
GitHub
Sep 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Notification is sent when state changes from no_data to ok (#18920)
parent
1bd4f511
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
3 deletions
+9
-3
pkg/services/alerting/notifiers/base.go
+2
-3
pkg/services/alerting/notifiers/base_test.go
+7
-0
No files found.
pkg/services/alerting/notifiers/base.go
View file @
388d3d37
...
...
@@ -71,11 +71,10 @@ func (n *NotifierBase) ShouldNotify(ctx context.Context, context *alerting.EvalC
}
}
unknownOrNoData
:=
prevState
==
models
.
AlertStateUnknown
||
prevState
==
models
.
AlertStateNoData
okOrPending
:=
newState
==
models
.
AlertStatePending
||
newState
==
models
.
AlertStateOK
// Do not notify when new state is ok/pending when previous is unknown
or no_data
if
unknownOrNoData
&&
okOrPending
{
// Do not notify when new state is ok/pending when previous is unknown
if
prevState
==
models
.
AlertStateUnknown
&&
okOrPending
{
return
false
}
...
...
pkg/services/alerting/notifiers/base_test.go
View file @
388d3d37
...
...
@@ -157,6 +157,13 @@ func TestShouldSendAlertNotification(t *testing.T) {
expect
:
false
,
},
{
name
:
"no_data -> ok"
,
prevState
:
models
.
AlertStateNoData
,
newState
:
models
.
AlertStateOK
,
expect
:
true
,
},
}
for
_
,
tc
:=
range
tcs
{
...
...
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