-
Notifications
You must be signed in to change notification settings - Fork 490
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
fix: topic-handler duration() -> alertDuration() #2448
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.
Are there any low-hanging automated tests we could add?
@@ -2,6 +2,10 @@ | |||
|
|||
## Unreleased | |||
|
|||
### Bugfixes | |||
- [#2448](https://github.com/influxdata/kapacitor/pull/2448): Changes the alert-handler match function duration() to be alertDuration() to avoid name collision with the type conversion function of the same name. |
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.
Is this something we can change in a patch release? Or is it not really a breaking change because the collision was preventing all uses of the match function form?
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.
Yah, it isn't a breaking change because the old duration()
function never actually worked.
if spec.Match != "" { | ||
// Wrap handler in match handler | ||
handlerDiag := s.diag.WithHandlerContext(ctx...) | ||
h, err = newMatchHandler(spec.Match, h, handlerDiag) | ||
if h == nil { | ||
panic("handler is nil, this should not happen") |
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.
Does this one need to be a panic? Could we return an err
instead?
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.
It is a state that should never happen and should panic. The problem was it was panic-ing in a very distant place and made it hard to debug.
services/alert/handlers.go
Outdated
|
||
if h.h == nil { | ||
panic("h.h is nil") | ||
} |
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.
This looks like a debug check, do we want to leave it in?
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.
Doh, I thought I removed it.
the topic handler match function
duration()
was colliding with the lambda function type conversion functionduration
. This removes that collision by changing the name of the topic handler match function toalertDuration
.