-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Track time diff between new_payload
and FCU
#12245
Track time diff between new_payload
and FCU
#12245
Conversation
Hello @mattsse, let me know your thoughts on this approach and whether it should be applied to the other payloads or if any adjustments are needed. |
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.
great, some suggestions
use std::{ | ||
sync::{Arc, Mutex}, | ||
time::Instant, | ||
}; |
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 should use parking_lot::Mutex
@@ -44,6 +47,7 @@ const MAX_BLOB_LIMIT: usize = 128; | |||
/// functions in the Execution layer that are crucial for the consensus process. | |||
pub struct EngineApi<Provider, EngineT: EngineTypes, Pool, Validator, ChainSpec> { | |||
inner: Arc<EngineApiInner<Provider, EngineT, Pool, Validator, ChainSpec>>, | |||
start_time: Mutex<Option<Instant>>, |
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 should go into the inner type, because the EngineApi
type is cloned per request
let elapsed_time = self | ||
.start_time | ||
.lock() | ||
.unwrap() | ||
.expect("start_time should be set before fork_choice_updated_v1 is called") | ||
.elapsed(); | ||
|
||
self.inner.metrics.payload_to_fcu_latency.new_payload_v1_time_diff.record(elapsed_time); |
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.
we can make this a standalone function of the inner type
.start_time | ||
.lock() | ||
.unwrap() | ||
.expect("start_time should be set before fork_choice_updated_v1 is called") |
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.
and this can't use unwrap here, and should only update if there is an instant
let elapsed_time = self | ||
.start_time | ||
.lock() | ||
.unwrap() |
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.
.unwrap() | |
.take() |
@mattsse comments addressed, let me know how it looks :) |
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
wip #12212