Skip to content
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

Merged
merged 1 commit into from Mar 8, 2018

Conversation

dperny
Copy link
Collaborator

@dperny dperny commented Mar 7, 2018

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.

// 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"
Copy link
Contributor

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 {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to err != ErrMemberUnknown ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not worth fixing.

Copy link
Contributor

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"
Copy link
Contributor

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 ?

Copy link
Collaborator Author

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.

Copy link
Contributor

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

@dperny dperny force-pushed the info-level-leader-elections branch 2 times, most recently from 5747e31 to abfd94a Compare March 7, 2018 23:42
@dperny
Copy link
Collaborator Author

dperny commented Mar 7, 2018

@anshulpundir changed to "not yet part of a raft cluster" but i disagree with the other two suggestions.

@dperny dperny force-pushed the info-level-leader-elections branch from abfd94a to 29abbd4 Compare March 8, 2018 22:02
@anshulpundir
Copy link
Contributor

CI is still not green @dperny

🐳 misspell
./manager/state/raft/raft.go:1707:49: "unkonwn" is a misspelling of "unknown"
make: *** [misspell] Error 1

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>
@dperny dperny force-pushed the info-level-leader-elections branch from 29abbd4 to 9a54111 Compare March 8, 2018 23:06
@codecov
Copy link

codecov bot commented Mar 8, 2018

Codecov Report

Merging #2542 into master will increase coverage by 0.05%.
The diff coverage is 78.94%.

@@            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

Copy link
Contributor

@anshulpundir anshulpundir left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants