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

feat: Add blob size metrics #2411

Merged
merged 4 commits into from
Jul 11, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 9 additions & 21 deletions core/node/proof_data_handler/src/metrics.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
use vise::{Histogram, Metrics};
use zksync_basic_types::basic_fri_types::Eip4844Blobs;
use zksync_object_store::StoredObject;
use zksync_prover_interface::inputs::{
VMRunWitnessInputData, WitnessInputData, WitnessInputMerklePaths,
};
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 {
Expand All @@ -20,24 +19,13 @@ pub(super) struct ProofDataHandlerMetrics {
impl ProofDataHandlerMetrics {
pub fn observe_blob_sizes(&self, blob: &WitnessInputData) {
let vm_run_data_blob_size_in_mb =
<VMRunWitnessInputData as StoredObject>::serialize(&blob.vm_run_data)
.unwrap()
.len() as u64
/ (1024 * 1024);
bincode::serialize(&blob.vm_run_data).unwrap().len() as u64 / BYTES_IN_MEGABYTE;
Artemka374 marked this conversation as resolved.
Show resolved Hide resolved
let merkle_paths_blob_size_in_mb =
<WitnessInputMerklePaths as StoredObject>::serialize(&blob.merkle_paths)
.unwrap()
.len() as u64
/ (1024 * 1024);
bincode::serialize(&blob.merkle_paths).unwrap().len() as u64 / BYTES_IN_MEGABYTE;
let eip_4844_blob_size_in_mb =
<Eip4844Blobs as StoredObject>::serialize(&blob.eip_4844_blobs)
.unwrap()
.len() as u64
/ (1024 * 1024);
let total_blob_size_in_mb = <WitnessInputData as StoredObject>::serialize(blob)
.unwrap()
.len() as u64
/ (1024 * 1024);
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);
Expand Down
Loading