-
Notifications
You must be signed in to change notification settings - Fork 359
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 Improve log when agent fails to join a new Node #6048
Conversation
…luster Signed-off-by: Roopesh Saravanan <roopeshsaravanan.dev@gmail.com>
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.
The title is so long that it's truncated in a way that doesn't look neat.
Ideally the title should be less than 50 characters. Consider "Improve log when agent fails to join a new Node"
pkg/agent/memberlist/cluster.go
Outdated
errorMessage := err.Error() | ||
prefixToRemove := "1 error occurred:" | ||
errorMessage = strings.TrimPrefix(errorMessage, prefixToRemove) | ||
errorMessage = strings.Replace(errorMessage, "\n\t* ", "", -1) | ||
errorMessage = strings.TrimSpace(errorMessage) |
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 is too specific to the error's format and content. It should handle the case more generically.
Given that the type of the error returned by c.mList.Join
is github.com/hashicorp/go-multierror.Error
, and we know there could be at most 1 wrapped error (we only join 1 member in this case), we can just call errors.Unwrap(err)
to get the wrapped error and use it in the log.
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.
Sure, let me check that.
Signed-off-by: Roopesh Saravanan <roopeshsaravanan.dev@gmail.com>
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, thanks
/skip-all |
Formatted the error logs when the agent tries to establish a cluster with others. It will recover eventually after all agents are up.
Fixes #5966