-
Notifications
You must be signed in to change notification settings - Fork 489
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
allowing sensu handler to be specified #1299
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. I had a question below...
pipeline/alert.go
Outdated
@@ -949,6 +949,7 @@ func (a *AlertaHandler) Services(service ...string) *AlertaHandler { | |||
// enabled = true | |||
// url = "http://sensu:3030" | |||
// source = "Kapacitor" | |||
// handlers = "sns" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would you list multiple handlers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would you want different handlers per alert or global to all alerts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good questions. I checked in some code that would allow for a list of handlers. I only needed one, but lists work as well.
I could understand a need for having different handlers per alert, but we only need a single global one at the moment.
Can you fix this failing test?
|
Sure thing. Let me know if you need anything else. |
I think it would be more complete to add the list of handlers to the each instance of a sensu handler. That way you can specify them globally and per alert. It shouldn't be too much more work and here is an open PR doing something very similar #1314 . Do you think you could take a crack at adding Handlers on a per alert basis? |
services/sensu/config.go
Outdated
@@ -11,6 +11,8 @@ type Config struct { | |||
Addr string `toml:"addr" override:"addr"` | |||
// The JIT sensu source name of the alert. | |||
Source string `toml:"source" override:"source"` | |||
// The sensu handler to use | |||
Handlers []string `toml:"handlers"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding the override
tag here will make it so that the tests above use the lower case name to be consistent.
6095a59
to
08b7dfa
Compare
Hey @nathanielc, I have added the changes to allow handlers on a per alert basis. Let me know if you need anything else. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look great! Just one small change requested.
services/sensu/service.go
Outdated
Name: "testName", | ||
Source: "Kapacitor", | ||
Output: "testOutput", | ||
Handlers: []string{"testHandlers"}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default I think it would be best to have an empty list of Handlers. Otherwise a default call to test the sensu service will probably fail.
08b7dfa
to
b6f27d5
Compare
allowing sensu handler to be specified
Required for all non-trivial PRs
Required only if applicable
You can erase any checkboxes below this note if they are not applicable to your Pull Request.