-
Notifications
You must be signed in to change notification settings - Fork 18
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
feat: Make logs easy to reason about #28
Conversation
src/main.rs
Outdated
drop(stats_lock); | ||
|
||
let block_processing_speed: f64 = | ||
(stats_copy.done_count as f64 - prev_done_count as f64) / interval_secs as f64; |
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.
I'd prefer to add braces here and in all places where you do math + casts.
It could divide by interval_secs
without changing the type, and then cast the result to f64
.
I don't remember the parsing order, it's better not to rely on this
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.
I hope I get it right, could you have a look again?
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.
You got it right, now it's better!
src/main.rs
Outdated
#[derive(Debug, Clone)] | ||
struct Stats { | ||
pub processing: std::collections::BTreeSet<u64>, | ||
pub done_count: u64, |
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.
Let's rename this variable?
blocks_processed_count
or anything else
src/main.rs
Outdated
|
||
const INDEXER: &str = "near_lake"; | ||
|
||
#[derive(Debug, Clone)] | ||
struct Stats { | ||
pub processing: std::collections::BTreeSet<u64>, |
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.
Let's rename this variable? It's not intuitive
src/main.rs
Outdated
@@ -15,16 +15,16 @@ const INDEXER: &str = "near_lake"; | |||
|
|||
#[derive(Debug, Clone)] | |||
struct Stats { | |||
pub processing: std::collections::BTreeSet<u64>, | |||
pub done_count: u64, | |||
pub blocks_processing: std::collections::BTreeSet<u64>, |
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.
block_heights_processing
?
@@ -15,6 +15,7 @@ aws-sdk-s3 = "0.6.0" | |||
aws-smithy-http = "0.36.0" | |||
clap = { version = "3.0.0-beta.5", features = ["color", "derive", "env"] } | |||
futures = "0.3.5" | |||
humantime = "2.1.0" |
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.
I thought about our random coffee at first 😅
src/main.rs
Outdated
@@ -111,14 +111,14 @@ async fn lake_logger( | |||
drop(stats_lock); | |||
|
|||
let block_processing_speed: f64 = | |||
(stats_copy.done_count as f64 - prev_done_count as f64) / interval_secs as f64; | |||
((stats_copy.blocks_processed_count - prev_done_count) as f64) / (interval_secs as f64); |
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.
Let's also rename prev_done_count
Closes #11
Logs will be printed every 10 seconds like in
nearcore
Example:
Originally in the issue @frol said
But I don't think it'd be helpful to print a bunch of blocks height, I think the number of the currently in-progress blocks should be enough. However, we can change it later.