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
52ccb491
Unverified
Commit
52ccb491
authored
Dec 19, 2018
by
Carl Bergquist
Committed by
GitHub
Dec 19, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #14593 from bergquist/export_create_notifier_func
export init notifier func
parents
d0f8d034
69489993
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
+5
-3
pkg/services/alerting/notifier.go
+4
-2
pkg/services/alerting/test_notification.go
+1
-1
No files found.
pkg/services/alerting/notifier.go
View file @
52ccb491
...
...
@@ -166,7 +166,7 @@ func (n *notificationService) getNeededNotifiers(orgId int64, notificationIds []
var
result
notifierStateSlice
for
_
,
notification
:=
range
query
.
Result
{
not
,
err
:=
n
.
createNotifierFo
r
(
notification
)
not
,
err
:=
InitNotifie
r
(
notification
)
if
err
!=
nil
{
n
.
log
.
Error
(
"Could not create notifier"
,
"notifier"
,
notification
.
Id
,
"error"
,
err
)
continue
...
...
@@ -195,7 +195,8 @@ func (n *notificationService) getNeededNotifiers(orgId int64, notificationIds []
return
result
,
nil
}
func
(
n
*
notificationService
)
createNotifierFor
(
model
*
m
.
AlertNotification
)
(
Notifier
,
error
)
{
// InitNotifier instantiate a new notifier based on the model
func
InitNotifier
(
model
*
m
.
AlertNotification
)
(
Notifier
,
error
)
{
notifierPlugin
,
found
:=
notifierFactories
[
model
.
Type
]
if
!
found
{
return
nil
,
errors
.
New
(
"Unsupported notification type"
)
...
...
@@ -208,6 +209,7 @@ type NotifierFactory func(notification *m.AlertNotification) (Notifier, error)
var
notifierFactories
=
make
(
map
[
string
]
*
NotifierPlugin
)
// RegisterNotifier register an notifier
func
RegisterNotifier
(
plugin
*
NotifierPlugin
)
{
notifierFactories
[
plugin
.
Type
]
=
plugin
}
...
...
pkg/services/alerting/test_notification.go
View file @
52ccb491
...
...
@@ -32,7 +32,7 @@ func handleNotificationTestCommand(cmd *NotificationTestCommand) error {
Settings
:
cmd
.
Settings
,
}
notifiers
,
err
:=
notifier
.
createNotifierFo
r
(
model
)
notifiers
,
err
:=
InitNotifie
r
(
model
)
if
err
!=
nil
{
log
.
Error2
(
"Failed to create notifier"
,
"error"
,
err
.
Error
())
...
...
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