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: Add blob size metrics (matter-labs#2411)
## What ❔ Add metrics for witness input data blob sizes ## Why ❔ To have deeper understanding of what is right and what is wrong ## 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). - [x] 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`.
- Loading branch information
1 parent
79ebde5
commit daf853e
Showing
5 changed files
with
47 additions
and
1 deletion.
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
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,41 @@ | ||
use vise::{Histogram, Metrics}; | ||
use zksync_object_store::bincode; | ||
use zksync_prover_interface::inputs::WitnessInputData; | ||
|
||
const BYTES_IN_MEGABYTE: u64 = 1024 * 1024; | ||
|
||
#[derive(Debug, Metrics)] | ||
pub(super) struct ProofDataHandlerMetrics { | ||
#[metrics(buckets = vise::Buckets::exponential(1.0..=2_048.0, 2.0))] | ||
pub vm_run_data_blob_size_in_mb: Histogram<u64>, | ||
#[metrics(buckets = vise::Buckets::exponential(1.0..=2_048.0, 2.0))] | ||
pub merkle_paths_blob_size_in_mb: Histogram<u64>, | ||
#[metrics(buckets = vise::Buckets::exponential(1.0..=2_048.0, 2.0))] | ||
pub eip_4844_blob_size_in_mb: Histogram<u64>, | ||
#[metrics(buckets = vise::Buckets::exponential(1.0..=2_048.0, 2.0))] | ||
pub total_blob_size_in_mb: Histogram<u64>, | ||
} | ||
|
||
impl ProofDataHandlerMetrics { | ||
pub fn observe_blob_sizes(&self, blob: &WitnessInputData) { | ||
let vm_run_data_blob_size_in_mb = | ||
bincode::serialize(&blob.vm_run_data).unwrap().len() as u64 / BYTES_IN_MEGABYTE; | ||
let merkle_paths_blob_size_in_mb = | ||
bincode::serialize(&blob.merkle_paths).unwrap().len() as u64 / BYTES_IN_MEGABYTE; | ||
let eip_4844_blob_size_in_mb = | ||
bincode::serialize(&blob.eip_4844_blobs).unwrap().len() as u64 / BYTES_IN_MEGABYTE; | ||
let total_blob_size_in_mb = | ||
bincode::serialize(blob).unwrap().len() as u64 / BYTES_IN_MEGABYTE; | ||
|
||
self.vm_run_data_blob_size_in_mb | ||
.observe(vm_run_data_blob_size_in_mb); | ||
self.merkle_paths_blob_size_in_mb | ||
.observe(merkle_paths_blob_size_in_mb); | ||
self.eip_4844_blob_size_in_mb | ||
.observe(eip_4844_blob_size_in_mb); | ||
self.total_blob_size_in_mb.observe(total_blob_size_in_mb); | ||
} | ||
} | ||
|
||
#[vise::register] | ||
pub(super) static METRICS: vise::Global<ProofDataHandlerMetrics> = 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