This repository has been archived by the owner on Aug 28, 2024. It is now read-only.
forked from matter-labs/zksync-era
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(vm-runner): add basic metrics (matter-labs#2203)
## What ❔ This PR just adds some basic VM runner-specific metrics. Note that VM runner already inherits VM-related metrics from state keeper. I decided to split `storage_load`/`vm_run`/`output_handle` into 3 different metrics as opposed to a single metric with 3 stages as the stages happen asynchronously and don't represent a continuous execution. Lmk if you disagree though. ## Why ❔ <!-- Why are these changes done? What goal do they contribute to? What are the principles behind them? --> <!-- Example: PR templates ensure PR reviewers, observers, and future iterators are in context about the evolution of repos. --> ## Checklist <!-- Check your PR fulfills the following items. --> <!-- For draft PRs check the boxes as you complete them. --> - [x] PR title corresponds to the body of PR (we generate changelog entries from PRs). - [ ] Tests for the changes have been added / updated. - [x] Documentation comments have been added / updated. - [x] Code has been formatted via `zk fmt` and `zk lint`. - [x] Spellcheck has been run via `zk spellcheck`.
- Loading branch information
Showing
7 changed files
with
49 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ mod output_handler; | |
mod process; | ||
mod storage; | ||
|
||
mod metrics; | ||
#[cfg(test)] | ||
mod tests; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
//! Metrics for `VmRunner`. | ||
use std::time::Duration; | ||
|
||
use vise::{Buckets, Gauge, Histogram, Metrics}; | ||
|
||
#[derive(Debug, Metrics)] | ||
#[metrics(prefix = "vm_runner")] | ||
pub(super) struct VmRunnerMetrics { | ||
/// Last batch that has been marked as processed. | ||
pub last_processed_batch: Gauge<u64>, | ||
/// Last batch that is ready to be processed. | ||
pub last_ready_batch: Gauge<u64>, | ||
/// Current amount of batches that are being processed. | ||
pub in_progress_l1_batches: Gauge<u64>, | ||
/// Total latency of loading an L1 batch (RocksDB mode only). | ||
#[metrics(buckets = Buckets::LATENCIES)] | ||
pub storage_load_time: Histogram<Duration>, | ||
/// Total latency of running VM on an L1 batch. | ||
#[metrics(buckets = Buckets::LATENCIES)] | ||
pub run_vm_time: Histogram<Duration>, | ||
/// Total latency of handling output of an L1 batch. | ||
#[metrics(buckets = Buckets::LATENCIES)] | ||
pub output_handle_time: Histogram<Duration>, | ||
} | ||
|
||
#[vise::register] | ||
pub(super) static METRICS: vise::Global<VmRunnerMetrics> = vise::Global::new(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters