-
Notifications
You must be signed in to change notification settings - Fork 29
add metrics to track gas used by reverting txs #273
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
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 |
---|---|---|
|
@@ -123,14 +123,16 @@ pub struct OpRBuilderMetrics { | |
pub payload_num_tx_simulated_fail: Histogram, | ||
/// Latest number of transactions in the payload that failed simulation | ||
pub payload_num_tx_simulated_fail_gauge: Gauge, | ||
/// Histogram of gas used by successful transactions | ||
pub successful_tx_gas_used: Histogram, | ||
/// Histogram of gas used by reverted transactions | ||
pub reverted_tx_gas_used: Histogram, | ||
/// Gas used by reverted transactions in the latest block | ||
pub payload_reverted_tx_gas_used: Gauge, | ||
/// Histogram of tx simulation duration | ||
pub tx_simulation_duration: Histogram, | ||
/// Byte size of transactions | ||
pub tx_byte_size: Histogram, | ||
/// Da block size limit | ||
pub da_block_size_limit: Gauge, | ||
/// Da tx size limit | ||
pub da_tx_size_limit: Gauge, | ||
/// How much less flashblocks we issue to be on time with block construction | ||
pub reduced_flashblocks_number: Histogram, | ||
/// How much less flashblocks we issued in reality, comparing to calculated number for block | ||
|
@@ -152,6 +154,7 @@ pub struct OpRBuilderMetrics { | |
} | ||
|
||
impl OpRBuilderMetrics { | ||
#[expect(clippy::too_many_arguments)] | ||
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. can group these metrics as a struct instead of adding more args 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. do you mean a type where each field is one of these args? i'm not sure that's a good idea it would introduce more complexity than just having the directive to ignore the lint here |
||
pub fn set_payload_builder_metrics( | ||
&self, | ||
payload_tx_simulation_time: impl IntoF64 + Copy, | ||
|
@@ -160,6 +163,7 @@ impl OpRBuilderMetrics { | |
num_txs_simulated_success: impl IntoF64 + Copy, | ||
num_txs_simulated_fail: impl IntoF64 + Copy, | ||
num_bundles_reverted: impl IntoF64, | ||
reverted_gas_used: impl IntoF64, | ||
) { | ||
self.payload_tx_simulation_duration | ||
.record(payload_tx_simulation_time); | ||
|
@@ -178,6 +182,7 @@ impl OpRBuilderMetrics { | |
self.payload_num_tx_simulated_fail_gauge | ||
.set(num_txs_simulated_fail); | ||
self.bundles_reverted.record(num_bundles_reverted); | ||
self.payload_reverted_tx_gas_used.set(reverted_gas_used); | ||
} | ||
} | ||
|
||
|
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.
does this not need reverted_gas_used += gas_used?
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.
no i'm only tracking reverted gas when the tx reverts
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.
sorry I meant successful_tx_gas_used += gas_used
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.
that would calculate the cumulative gas used by successful txs in a block. reth already tracks this in the reth_sync_execution_gas_processed_total metrics. successful_tx_gas_used is a histogram metric so it will tell us what the distribution of gas looks like used by each tx