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
Log leadership changes at manager level #2542
Conversation
manager/manager.go
Outdated
// node is not a member of the raft quorum. this won't look very pretty | ||
// in logs ("leadership changed from aslkdjfa to ErrNoRaftMember") but | ||
// it also won't be very common | ||
return "ErrNoRaftMember" |
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.
Change to "not yet part of a raft cluster"
default: | ||
id, err := m.raftNode.GetNodeIDByRaftID(leader) | ||
// the only possible error here is "ErrMemberUnknown" | ||
if err != 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.
Change to err != ErrMemberUnknown ?
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.
not worth fixing.
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.
care to elaborate ? @dperny
id, err := m.raftNode.GetNodeIDByRaftID(leader) | ||
// the only possible error here is "ErrMemberUnknown" | ||
if err != nil { | ||
return "an unknown node" |
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 not very useful in the logs either. Any way to make this somewhat less confusing ?
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.
probably not. it's an unlikely case that this happens, and if it does happen, you'll need to look at the logs output by the raft library.
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.
Let me clarify: my suggestion is to find out what is the scenario when we can get a ErrMemberUnknown and try to return a string that explains that scenario. @dperny
5747e31
to
abfd94a
Compare
@anshulpundir changed to "not yet part of a raft cluster" but i disagree with the other two suggestions. |
abfd94a
to
29abbd4
Compare
CI is still not green @dperny 🐳 misspell |
Updates (*Manager).handleLeadershipEvent to include a log message explaining where the leadership changed, using swarmkit node IDs instead of the raft node ids, at the Info level. Signed-off-by: Drew Erny <drew.erny@docker.com>
29abbd4
to
9a54111
Compare
Codecov Report
@@ Coverage Diff @@
## master #2542 +/- ##
=========================================
+ Coverage 61.45% 61.5% +0.05%
=========================================
Files 133 133
Lines 21746 21755 +9
=========================================
+ Hits 13363 13380 +17
- Misses 6937 6941 +4
+ Partials 1446 1434 -12 |
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.
Spoke with @dperny offline and resolved the comments. I'm fine with the changes.
Updates (*Manager).handleLeadershipEvent to include a log message explaining where the leadership changed, using swarmkit node IDs instead of the raft node ids, at the Info level.