Skip to content

Commit

Permalink
add label to transaction inclusion metric; refine buckets
Browse files Browse the repository at this point in the history
  • Loading branch information
RomanBrodetski committed Feb 16, 2024
1 parent 6f715c8 commit 64dcb43
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions core/lib/zksync_core/src/state_keeper/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ pub(crate) enum TxExecutionStage {
DryRunRollback,
}

#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, EncodeLabelValue, EncodeLabelSet)]
#[metrics(label = "level", rename_all = "snake_case")]
pub(crate) enum TxExecutionType {
L1,
L2,
}

const INCLUSION_DELAY_BUCKETS: Buckets = Buckets::values(&[
0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9,
2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0,
]);

/// General-purpose state keeper metrics.
#[derive(Debug, Metrics)]
#[metrics(prefix = "server_state_keeper")]
Expand All @@ -53,8 +65,8 @@ pub(crate) struct StateKeeperMetrics {
#[metrics(buckets = Buckets::LATENCIES)]
pub load_previous_miniblock_header: Histogram<Duration>,
/// The time it takes for transactions to be included in a block. Representative of the time user must wait before their transaction is confirmed.
#[metrics(buckets = Buckets::LATENCIES)]
pub transaction_inclusion_delay: Histogram<Duration>,
#[metrics(buckets = INCLUSION_DELAY_BUCKETS)]
pub transaction_inclusion_delay: Family<TxExecutionType, Histogram<Duration>>,
/// Time spent by the state keeper on transaction execution.
#[metrics(buckets = Buckets::LATENCIES)]
pub tx_execution_time: Family<TxExecutionStage, Histogram<Duration>>,
Expand Down

0 comments on commit 64dcb43

Please sign in to comment.