-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Include missing key in error message for KV store #3779
Conversation
cluster/datastore.go
Outdated
@@ -78,7 +78,7 @@ func (d *Datastore) watchChanges() error { | |||
stopCh := make(chan struct{}) | |||
kvCh, err := d.kv.Watch(d.lockKey, stopCh, nil) | |||
if err != nil { | |||
return err | |||
return fmt.Errorf("%v: %s", err, d.lockKey) |
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.
Can you add a sentence here like error while watching key %s: %v
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
Improves the operator experience when debugging issues like traefik#2712
2249a20
to
57129a0
Compare
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
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
Why not simply bootstrap etcd with lock and object when the etcd entry is present ? It's so much complicated to "pre bootstrap" etcd by playing one time script ... Don't understand this choice to throw an error that say "you need to bootstrap" rather than auto bootstrap |
What does this PR do?
The generic missing-key error message that comes from valkeyrie doesn't point the operator at the key that's missing. Several folk, including myself, have spent time figuring out what that missing key is. When setting up TLS there's a further potential confusion between KV store keys and TLS keys!
See #2712 for an example issue that might have gone smoother with this more detailed logging.
Motivation
I spent several hours debugging this, and that time could've been saved by knowing what the missing key was.
More
No tests / docs updated. I don't believe this warrants a test.
I began running the tests but had to go do something else before they finished!
Additional Notes
Worth checking that the format string is safe with all possible return values.