-
Notifications
You must be signed in to change notification settings - Fork 132
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
Refactor failed heartbeats log #1273
Conversation
fa754b4
to
42117b5
Compare
internal/internal_task_handlers.go
Outdated
} | ||
// If the error is a canceled error do not log, as this is expected. | ||
var canceledErr *CanceledError | ||
if errors.As(err, &canceledErr) { |
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.
You need to reverse the check.
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.
Yep, thanks!
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.
yeah - all this code is stranger than I originally thought too :|
logging on workflow-complete and other "stop the activity" cases should be relatively rare in comparison, and we can filter those out later too if we want. or rewrite this code, it seems unlikely to be doing what it should in those situations.
internal/internal_task_handlers.go
Outdated
} | ||
// If the error is a canceled error do not log, as this is expected. | ||
var canceledErr *CanceledError | ||
if canceledErr != nil && !errors.As(err, &canceledErr) { |
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.
canceledErr is always nil and err is checked for nil inside errors.As.
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.
also, maybe put this into a method and add a test so you are 100% sure about the behaviour.
Something like
i.processHearbeatError(err)
and then add unit test with zaptest.Logger.
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.
Please revert recent change :)
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.
LGTM
* Refactored the log type check * Wrong check - reversed * Added nil check * Added tests, and fixed nil error
What changed?
Refactored the type check to use modern Go
What changed?
In modern go typecasting errors is sometimes not correct as they might be wrapped, the errors.As method is aware of this and checks all wrapped errors
How did you test it?
Tested locally
Potential risks
Worst case we log too much/too little