From 920eba15fc64b40f10fcc9f6910d5e7607f3d313 Mon Sep 17 00:00:00 2001 From: EmilLuta Date: Wed, 20 Nov 2024 12:13:27 +0100 Subject: [PATCH] fix: Add prometheus exporter to circut prover (#3311) Metrics were not exported for circuit prover. Prometheus exporter will export metrics. --- prover/Cargo.lock | 1 + prover/crates/bin/circuit_prover/Cargo.toml | 1 + prover/crates/bin/circuit_prover/src/main.rs | 10 ++++++++-- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/prover/Cargo.lock b/prover/Cargo.lock index af249b435a6b..559304d653e7 100644 --- a/prover/Cargo.lock +++ b/prover/Cargo.lock @@ -7881,6 +7881,7 @@ dependencies = [ "zksync_queued_job_processor", "zksync_types", "zksync_utils", + "zksync_vlog", ] [[package]] diff --git a/prover/crates/bin/circuit_prover/Cargo.toml b/prover/crates/bin/circuit_prover/Cargo.toml index d7b7a8ca80fd..8fecc7a7a6a1 100644 --- a/prover/crates/bin/circuit_prover/Cargo.toml +++ b/prover/crates/bin/circuit_prover/Cargo.toml @@ -33,6 +33,7 @@ zksync_core_leftovers.workspace = true zksync_utils.workspace = true zksync_circuit_prover_service.workspace = true zksync_prover_job_processor.workspace = true +zksync_vlog.workspace = true vise.workspace = true shivini = { workspace = true, features = [ diff --git a/prover/crates/bin/circuit_prover/src/main.rs b/prover/crates/bin/circuit_prover/src/main.rs index e115d1510657..a445ceca3abe 100644 --- a/prover/crates/bin/circuit_prover/src/main.rs +++ b/prover/crates/bin/circuit_prover/src/main.rs @@ -20,6 +20,7 @@ use zksync_prover_dal::{ConnectionPool, Prover}; use zksync_prover_fri_types::PROVER_PROTOCOL_SEMANTIC_VERSION; use zksync_prover_keystore::keystore::Keystore; use zksync_utils::wait_for_tasks::ManagedTasks; +use zksync_vlog::prometheus::PrometheusExporterConfig; /// On most commodity hardware, WVG can take ~30 seconds to complete. /// GPU processing is ~1 second. @@ -82,7 +83,10 @@ async fn main() -> anyhow::Result<()> { let cancellation_token = CancellationToken::new(); - let mut tasks = vec![]; + let exporter_config = PrometheusExporterConfig::pull(prover_config.prometheus_port); + let (metrics_stop_sender, metrics_stop_receiver) = tokio::sync::watch::channel(false); + + let mut tasks = vec![tokio::spawn(exporter_config.run(metrics_stop_receiver))]; let (witness_vector_sender, witness_vector_receiver) = tokio::sync::mpsc::channel(CHANNEL_SIZE); @@ -142,7 +146,9 @@ async fn main() -> anyhow::Result<()> { .shutdown_time .observe(shutdown_time.elapsed()); PROVER_BINARY_METRICS.run_time.observe(start_time.elapsed()); - + metrics_stop_sender + .send(true) + .context("failed to stop metrics")?; Ok(()) } /// Loads configs necessary for proving.