-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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: track persistence metrics #10250
Conversation
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.
some nits,
fn on_remove_blocks_above( | ||
&self, | ||
new_tip_num: u64, | ||
sender: oneshot::Sender<()>, |
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 doesn't need the sender as argument
fn on_save_blocks( | ||
&self, | ||
blocks: Vec<ExecutedBlock>, | ||
sender: oneshot::Sender<Option<B256>>, |
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.
same here, the function should return the Option and then caller should send it
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.
last nits
} | ||
PersistenceAction::PruneBefore(block_num, sender) => { | ||
let start_time = Instant::now(); |
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 move this into prune_before, so that we're consistent with where we track metrics
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.
@mattsse done
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.
@mattsse what's latency metrics for?
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 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, just one comment on removing self.rx = None
after take
remove unnecessary code
crates/engine/tree/src/metrics.rs
Outdated
/// How long it took for blocks to be removed | ||
pub(crate) remove_blocks_above_duration: Histogram, | ||
/// How long it took for blocks to be saved | ||
pub(crate) save_blocks_duration: Histogram, | ||
/// How long it took for blocks to be pruned | ||
pub(crate) prune_before_duration: Histogram, |
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.
/// How long it took for blocks to be removed | |
pub(crate) remove_blocks_above_duration: Histogram, | |
/// How long it took for blocks to be saved | |
pub(crate) save_blocks_duration: Histogram, | |
/// How long it took for blocks to be pruned | |
pub(crate) prune_before_duration: Histogram, | |
/// How long it took for blocks to be removed | |
pub(crate) remove_blocks_above_duration_seconds: Histogram, | |
/// How long it took for blocks to be saved | |
pub(crate) save_blocks_duration_seconds: Histogram, | |
/// How long it took for blocks to be pruned | |
pub(crate) prune_before_duration_seconds: Histogram, |
@@ -15,5 +15,7 @@ pub(crate) struct EngineApiMetrics { | |||
pub(crate) forkchoice_updated_messages: Counter, | |||
/// The total count of new payload messages received. | |||
pub(crate) new_payload_messages: Counter, | |||
/// Histogram of persistence operation durations (in seconds) | |||
pub(crate) persistence_duration: Histogram, |
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.
pub(crate) persistence_duration: Histogram, | |
pub(crate) persistence_duration_seconds: Histogram, |
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.
measuring this in seconds is not useful
crates/engine/tree/src/tree/mod.rs
Outdated
self.on_new_persisted_block(); | ||
} else { | ||
error!("could not find persisted block with hash {last_persisted_block_hash} in memory"); | ||
if let Some((mut rx, start_time)) = self.persistence_state.rx.take() { |
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 changes the behavior and we won't panic anymore, do we want this? @mattsse
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.
right, added the expect back
crates/engine/tree/src/tree/mod.rs
Outdated
self.last_persisted_block_number = last_persisted_block_number; | ||
self.last_persisted_block_hash = last_persisted_block_hash; | ||
duration |
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.
why do we need to return the duration here if we not used it for metrics?
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're correct we've already used 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.
pending @shekhirin
crates/engine/tree/src/tree/mod.rs
Outdated
self.last_persisted_block_number = last_persisted_block_number; | ||
self.last_persisted_block_hash = last_persisted_block_hash; | ||
duration |
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're correct we've already used this
crates/engine/tree/src/tree/mod.rs
Outdated
self.on_new_persisted_block(); | ||
} else { | ||
error!("could not find persisted block with hash {last_persisted_block_hash} in memory"); | ||
if let Some((mut rx, start_time)) = self.persistence_state.rx.take() { |
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.
right, added the expect back
Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de> Co-authored-by: Alexey Shekhirin <a.shekhirin@gmail.com>
closes #10220
closes #10221