Skip to content
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

Merged
merged 3 commits into from
Nov 6, 2024

Conversation

stevencartavia
Copy link
Contributor

wip #12212

@stevencartavia
Copy link
Contributor Author

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.

Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great, some suggestions

Comment on lines 30 to 33
use std::{
sync::{Arc, Mutex},
time::Instant,
};
Copy link
Collaborator

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>>,
Copy link
Collaborator

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

Comment on lines 253 to 260
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);
Copy link
Collaborator

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")
Copy link
Collaborator

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()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.unwrap()
.take()

@stevencartavia
Copy link
Contributor Author

@mattsse comments addressed, let me know how it looks :)

@mattsse mattsse marked this pull request as ready for review November 2, 2024 14:10
Copy link
Collaborator

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mattsse mattsse enabled auto-merge November 6, 2024 10:06
@mattsse mattsse added this pull request to the merge queue Nov 6, 2024
Merged via the queue into paradigmxyz:main with commit 4048117 Nov 6, 2024
41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants