-
Notifications
You must be signed in to change notification settings - Fork 493
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
Make Alerta event property configurable #461
Conversation
So I am a little confused. Kapacitor uses its ID field to correlate different alerts. Whats the value in allowing the As I understand the Alerta docs if I send these requests to Alerta:
The second warnings is de-duped and dropped. If either event of resource were different than they would be separate alerts entirely. Correct? |
Your understanding of how Alerta de-duplicates and correlates is spot on and yes, the integration between Kapacitor and Alerta could be made to work this way. However, it would be quite limiting. From your example above, it would make much more sense for the Think of the combination of It probably makes sense to default the |
@satterly Currently the
Would that not work? Is it just a mater of better documentation? |
Wouldn't that mean that alert generation in Kapacitor wouldn't work properly because someone wanting to integrate with Alerta would only want to put event name in the Kap ID so it would end up only generating one alert per alert definition for many different resources. That is, the Kap ID needs to make reference to a resource doesn't it? |
@satterly You are right. It would break Kapacitor's concept of an ID if they were also using another alerting system in addition to Alerta. Probably not a common use case but it would definitely be an obscure/confusing behavior. OK, so lets make this change as it make sense now. Just a few things...
Thanks! |
@nathanielc will do. And thanks for the feedback. The discussion was very useful in clarifying the approach. |
@@ -0,0 +1,22 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> |
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.
Can you remove these .idea files?
Here is the build failure output:
Have you been able to get the tests to run locally? You can use this comand to run only the Alerta tests. go test -run TestStream_AlertAlerta -v ./integrations |
When I run the tests I get ...
This would be expected because we only provide the |
@@ -907,6 +913,14 @@ func (a *AlertNode) handleAlerta(alerta alertaHandler, ad *AlertData) { | |||
resource := buf.String() | |||
buf.Reset() | |||
|
|||
err = alerta.eventTmpl.Execute(&buf, ad.info) |
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.
Right here you can create a new type like:
type eventData struct {
idInfo
ID string
}
data := eventData{
idInfo: ad.info.messageInfo.idInfo,
ID: ad.ID,
}
err = alerta.eventTmpl.Execute(&buf, data)
This way on the ID Info data can be used in addition to the ID itself.
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. Updated.
This is so that the user cannot create an event with data that changes depending on the state of the alert.
@satterly Looks great, Thanks! |
Make the Alerta event property configurable to ensure de-duplication and event correlation work as expected.