-
Notifications
You must be signed in to change notification settings - Fork 801
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
Visualisation logging for sync batch states #6034
Conversation
The visualization is nice!! 🔥 I couldn't get it to render on my terminal though, I've tried a few built-in fonts but they don't render, looks like I might have to install something from nerd-fonts? I tried emojis and they work well (on my machine) - think it might be worth considering since some of them have been part of the Unicode standard for a while and should have wide OS support. I've only tested on MacOS though ;) |
I installed the 0xProto font on my Ubuntu machine and saw the following icons: ![]() Using emojis seems like a good idea. 💡 |
Yeah sorry. The fonts I used aren't widely used. If someone can suggest some good emoji's maybe we can do with that. |
Some options: fn visualize(&self) -> &'static str {
match self {
BatchState::Downloading(_, _) => "⏬",
BatchState::Processing(_) => "🔄",
BatchState::AwaitingValidation(_) => "⏳",
BatchState::AwaitingDownload => "📥",
BatchState::Failed => "❌",
BatchState::AwaitingProcessing(_, _) => "🕓",
BatchState::Poisoned => "💀",
}
} Face emojis from neutral to happy face fn visualize(&self) -> &'static str {
match self {
BatchState::AwaitingDownload => "😐",
BatchState::Downloading(_, _) => "🙂",
BatchState::AwaitingProcessing(_, _) => "😊",
BatchState::Processing(_) => "😃",
BatchState::AwaitingValidation(_) => "😁",
BatchState::Failed => "😞",
BatchState::Poisoned => "😵",
}
} |
Awesome thanks. I replaced them with emoji's now. |
Not sure how I feel to have debug logs full of emojis now.. haha This batch state codes will be read by a small minority of devs who could memorize the meaning of a few letters. Plus there are ordering rules of states that reduce the max possible combination of states. ASCII has a bunch of disctict symbols that can de used. For example:
fn visualize(&self) -> &'static str {
match self {
BatchState::Downloading(_, _) => "D",
BatchState::Processing(_) => "P",
BatchState::AwaitingValidation(_) => "v",
BatchState::AwaitingDownload => "d",
BatchState::Failed => "F",
BatchState::AwaitingProcessing(_, _) => "p",
BatchState::Poisoned => "X",
}
} |
Yeah fair. I'm not sold on this PR and if people don't find it useful, happy to ditch it. The reason I built it was, i saw a couple of times sync being stalled and it was kind of pain to track down and figure out what we were waiting on this (because the batches are all numbers). Happy to switch to text for the states. If i get a few thumbs on this, then I'll consider this PR useful, switch to text and merge down. If not many thumbs <3, i'll close this PR |
Gave you both my thumbs 👍 |
Sync lookup has now a gadget to detect when it gets stuck and drops a nice long report to logs. This has been the key to debug stalls in minutes instead of hours. We could do the same for other syncs |
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.
Added some minor comments, otherwise looks good to me!
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.
There's a Cargo.lock
diff
@Mergifyio queue |
🛑 Branch protection settings are not validated anymoreBranch protection is enabled and is preventing Mergify to merge the pull request. Mergify will merge when branch protection settings validate the pull request once again. (detail: 1 review requesting changes and 1 approving review by reviewers with write access.) |
@mergify requeue |
✅ This pull request will be re-embarked automaticallyThe followup |
🛑 The pull request has been removed from the queue
|
@mergify requeue |
✅ This pull request will be re-embarked automaticallyThe followup |
🛑 Branch protection settings are not validated anymoreBranch protection is enabled and is preventing Mergify to merge the pull request. Mergify will merge when branch protection settings validate the pull request once again. (detail: 1 review requesting changes and 1 approving review by reviewers with write access.) |
@Mergifyio refresh |
✅ Pull request refreshed |
@mergify requeue |
✅ This pull request will be re-embarked automaticallyThe followup |
✅ The pull request has been merged automaticallyThe pull request has been merged automatically at a3b1ef3 |
I have been writing up logic about how sync works and also debugging some sync issues locally.
I thought it would be an improvement to have a visual representation of a current chain state, to help see where abouts the progress of a chain is at any given point from just eyeballing the logs.
I set a few icons to represent different batch states:
These are from
nerd-fonts
and should appear for any os with the fonts installed.These changes produce a small log when we are updating the chain state showing the current state of our block downloading buffer.
Here are some example logs I've run on a mainnet head sync:
It's not as handy as I had originally expected because the buffer is a moving window, but it is useful to show where sync might be stalling, how many we are currently downloading and what bottlenecks etc.
A more holistic approach is probably a proper sync grafana dash.