-
Notifications
You must be signed in to change notification settings - Fork 2.4k
feat(observability): add phase-level observablity to newPayload processing #18308
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
Changes from all commits
7acd0af
0196988
74286a0
d7d4e55
8bf14dc
cc79b55
17ca5f7
d655cf2
b8acbc2
629e149
0de42f0
9a696e7
dbaef41
bc01dc6
5fe3457
8268516
408f97a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -301,7 +301,9 @@ where | |
| Ok(val) => val, | ||
| Err(e) => { | ||
| let block = self.convert_to_block(input)?; | ||
| return Err(InsertBlockError::new(block.into_sealed_block(), e.into()).into()) | ||
| return Err( | ||
| InsertBlockError::new(block.into_sealed_block(), e.into()).into() | ||
| ) | ||
| } | ||
| } | ||
| }; | ||
|
|
@@ -403,7 +405,8 @@ where | |
| // Use state root task only if prefix sets are empty, otherwise proof generation is too | ||
| // expensive because it requires walking over the paths in the prefix set in every | ||
| // proof. | ||
| if trie_input.prefix_sets.is_empty() { | ||
| let spawn_payload_processor_start = Instant::now(); | ||
| let handle = if trie_input.prefix_sets.is_empty() { | ||
| self.payload_processor.spawn( | ||
| env.clone(), | ||
| txs, | ||
|
|
@@ -416,9 +419,25 @@ where | |
| debug!(target: "engine::tree", block=?block_num_hash, "Disabling state root task due to non-empty prefix sets"); | ||
| use_state_root_task = false; | ||
| self.payload_processor.spawn_cache_exclusive(env.clone(), txs, provider_builder) | ||
| } | ||
| }; | ||
|
|
||
| // record prewarming initialization duration | ||
| self.metrics | ||
| .block_validation | ||
| .spawn_payload_processor | ||
| .record(spawn_payload_processor_start.elapsed().as_secs_f64()); | ||
| handle | ||
| } else { | ||
| self.payload_processor.spawn_cache_exclusive(env.clone(), txs, provider_builder) | ||
| let prewarming_start = Instant::now(); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is this a duplicate as above with the |
||
| let handle = | ||
| self.payload_processor.spawn_cache_exclusive(env.clone(), txs, provider_builder); | ||
|
|
||
| // Record prewarming initialization duration | ||
| self.metrics | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Timosdev99 can we move the timing outside the if-else? so we can avoid dup?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if we move it outside wont the timing be inaccurate since we will have to start it before the process? @mattsse any suggestion?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can't move the timing outside the if-else because otherwise the trie input calculation would be captured in the branch above, which can be fairly expensive. So IMO this is fine |
||
| .block_validation | ||
| .spawn_payload_processor | ||
| .record(prewarming_start.elapsed().as_secs_f64()); | ||
| handle | ||
| }; | ||
|
|
||
| // Use cached state provider before executing, used in execution after prewarming threads | ||
|
|
@@ -453,6 +472,7 @@ where | |
| }; | ||
| } | ||
|
|
||
| let post_execution_start = Instant::now(); | ||
| trace!(target: "engine::tree", block=?block_num_hash, "Validating block consensus"); | ||
| // validate block consensus rules | ||
| ensure_ok!(self.validate_block_inner(&block)); | ||
|
|
@@ -481,6 +501,12 @@ where | |
| return Err(InsertBlockError::new(block.into_sealed_block(), err.into()).into()) | ||
| } | ||
|
|
||
| // record post-execution validation duration | ||
| self.metrics | ||
| .block_validation | ||
| .post_execution_validation_duration | ||
| .record(post_execution_start.elapsed().as_secs_f64()); | ||
|
|
||
| debug!(target: "engine::tree", block=?block_num_hash, "Calculating block state root"); | ||
|
|
||
| let root_time = Instant::now(); | ||
|
|
@@ -792,7 +818,7 @@ where | |
| ) { | ||
| if state.invalid_headers.get(&block.hash()).is_some() { | ||
| // we already marked this block as invalid | ||
| return; | ||
| return | ||
yongkangc marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| self.invalid_block_hook.on_invalid_block(parent_header, block, output, trie_updates); | ||
| } | ||
|
|
||
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.
might have missed the comment but why did we remove this?
@Rjected is this impt?
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.
@Timosdev99 can I check why did we remove 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.
is it not measuring the same metrics with state_root_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.
it's not technically measuring the same thing, because one is a histogram (which records in percentile buckets) and the other one is a duration (recording a point-in-time metric), so we should add this back