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

refactor: move exec metrics into executor #10426

Merged
merged 2 commits into from
Sep 4, 2024
Merged

Conversation

onbjerg
Copy link
Member

@onbjerg onbjerg commented Aug 21, 2024

Removes ExecutionStageMetrics and instead adds an ExecutorMetrics used to track things like gas processed, and more in the future.

Currently is not integrated into the blockchain tree.

This PR also adds an instantaneous gas/s metric to make this work well with live sync -- currently, if we just added the total gas processed from live sync and did a rate in Prometheus over it, performance would look abysmal on live sync, since it would divide the gas processed over the entire slot time (12s).

I've implemented this with a metered fn that takes a closure and measures the relevant metrics from the input and output. This is ok except it does not handle generic inputs.

An alternative I've considered (and still am) was adding some metering to the executor traits instead, since it allows us to handle generic inputs and outputs more easily

Future work could include adding metrics for sloads/sstores, bytecode reads/writes, and account loads/updates

Closes #10397 and closes #9863

@onbjerg onbjerg added A-execution Related to the Execution and EVM A-observability Related to tracing, metrics, logs and other observability tools labels Aug 21, 2024
@github-actions github-actions bot added the C-enhancement New feature or request label Aug 21, 2024
@onbjerg onbjerg force-pushed the onbjerg/executor-metrics branch 3 times, most recently from 0a2d9b9 to 1f24b9c Compare August 22, 2024 12:49
@onbjerg onbjerg marked this pull request as ready for review August 22, 2024 12:50
@onbjerg onbjerg marked this pull request as draft August 22, 2024 12:54
@onbjerg
Copy link
Member Author

onbjerg commented Aug 22, 2024

Last task is to update grafana

probably still needs some noodling to get a nicer
unit display
@onbjerg onbjerg marked this pull request as ready for review September 2, 2024 18:36
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

Comment on lines -85 to -87
MetricEvent::ExecutionStageGas { gas } => {
self.sync_metrics.execution_stage.mgas_processed_total.increment(gas / MEGAGAS)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

yeah this was a bit weird

Comment on lines +25 to +28
pub fn metered<F, R>(&self, input: BlockExecutionInput<'_, BlockWithSenders>, f: F) -> R
where
F: FnOnce(BlockExecutionInput<'_, BlockWithSenders>) -> R,
{
Copy link
Collaborator

Choose a reason for hiding this comment

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

this seems fine

@onbjerg onbjerg added this pull request to the merge queue Sep 4, 2024
Merged via the queue into main with commit d659cd3 Sep 4, 2024
36 checks passed
@onbjerg onbjerg deleted the onbjerg/executor-metrics branch September 4, 2024 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-execution Related to the Execution and EVM A-observability Related to tracing, metrics, logs and other observability tools C-enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Track gas used metrics in executor directly Live sync gas/s metric
2 participants