-
Notifications
You must be signed in to change notification settings - Fork 109
Add observability to rewind progress #2614
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
aad6f0c
to
0ae5996
Compare
// Count total blocks to rewind for progress tracking | ||
let mut total_blocks = 0; | ||
{ | ||
let mut cursor = self.tx.cursor_read::<DerivedBlocks>()?; | ||
let mut walker = cursor.walk(Some(block.number))?; | ||
while let Some(Ok(_)) = walker.next() { | ||
total_blocks += 1; | ||
} | ||
} | ||
|
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 too costly for observability logic, which is kind of "secondary logic" if that makes sense. just do latest block number minus target block number
let mut processed_blocks = 0; | ||
const LOG_INTERVAL: u64 = 100; | ||
|
||
info!("Starting rewind of {} blocks...", total_blocks); |
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.
target is missing and pls specify values as key value pairs, see how it's done for other logs. also pls add the target block, the latest block and total number of blocks to walk back.
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.
@emhane thank you, I have updated the code.
closes: #2593