feat(lib/hashring): add logs to hash ring membership wait#576
Merged
Conversation
egorikas
approved these changes
Mar 5, 2026
hweawer
approved these changes
Mar 5, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Improves observability of hash ring membership convergence by emitting structured logs from ring.WaitForContains on both success and timeout paths.
Changes:
- Add structured error log when
WaitForContainstimes out. - Add structured info log (including elapsed duration) when
WaitForContainssucceeds. - Store elapsed duration in a local variable before recording the membership-wait histogram.
Comments suppressed due to low confidence (1)
lib/hashring/ring.go:165
- The timeout log doesn’t include the actual time spent waiting. Since this change is specifically for observability, consider logging the elapsed duration (and optionally recording the histogram) on the error path too, so it’s easy to compare “waited” vs configured timeout when debugging slow/failed membership convergence.
if err := backoff.Retry(operation, backoff.WithContext(b, ctx)); err != nil {
log.With("addr", addr, "error", err, "timeout", r.config.MembershipWaitTimeout).Error("Timed out waiting to find address in hash ring")
return fmt.Errorf("timed out waiting for membership: %w", err)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR improves observability for the hashring
waitForContainsmethod by adding logs to both paths.