Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
19 changes: 1 addition & 18 deletions core/lib/basic_types/src/basic_fri_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ impl IntoIterator for ProtocolVersionedCircuitProverStats {
}

/// Wrapper for mapping between circuit/aggregation round to number of such jobs (queued and in progress)
#[derive(Debug)]
#[derive(Debug, Default)]
pub struct CircuitProverStats {
circuits_prover_stats: HashMap<CircuitIdRoundTuple, JobCountStatistics>,
}
Expand Down Expand Up @@ -286,23 +286,6 @@ impl CircuitProverStats {
}
}

impl Default for CircuitProverStats {
fn default() -> Self {
let circuits_prover_stats = AggregationRound::ALL_ROUNDS
.into_iter()
.flat_map(|round| {
let circuit_ids = round.circuit_ids();
circuit_ids.into_iter().map(|circuit_id_round_tuple| {
(circuit_id_round_tuple, JobCountStatistics::default())
})
})
.collect();
Self {
circuits_prover_stats,
}
}
}

/// DTO for communication between DAL and prover_job_monitor.
/// Represents an entry -- count (queued & in progress) of jobs (circuit_id, aggregation_round) for a given protocol version.
#[derive(Debug)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
use std::collections::HashMap;

use async_trait::async_trait;
use zksync_prover_dal::{Connection, Prover, ProverDal};
use zksync_types::{basic_fri_types::CircuitIdRoundTuple, prover_dal::JobCountStatistics};

use crate::{metrics::FRI_PROVER_METRICS, task_wiring::Task};
use crate::{
metrics::{ProverJobsLabels, FRI_PROVER_METRICS},
task_wiring::Task,
};

/// `ProverQueueReporter` is a task that reports prover jobs status.
/// Note: these values will be used for auto-scaling provers and Witness Vector Generators.
Expand All @@ -17,6 +22,8 @@ impl Task for ProverQueueReporter {
.get_prover_jobs_stats()
.await;

let mut prover_jobs_metric: HashMap<_, _> =
FRI_PROVER_METRICS.prover_jobs.to_entries().collect();
for (protocol_semantic_version, circuit_prover_stats) in stats {
for (tuple, stat) in circuit_prover_stats {
let CircuitIdRoundTuple {
Expand All @@ -28,6 +35,15 @@ impl Task for ProverQueueReporter {
in_progress,
} = stat;

["queued", "in_progress"].iter().for_each(|t| {
prover_jobs_metric.remove(&ProverJobsLabels {
r#type: t,
circuit_id: circuit_id.to_string(),
aggregation_round: aggregation_round.to_string(),
protocol_version: protocol_semantic_version.to_string(),
});
});

FRI_PROVER_METRICS.report_prover_jobs(
"queued",
circuit_id,
Expand All @@ -46,6 +62,11 @@ impl Task for ProverQueueReporter {
}
}

// Clean up all unset in this round metrics.
prover_jobs_metric.iter().for_each(|(k, _)| {
FRI_PROVER_METRICS.prover_jobs[k].set(0);
});

let lag_by_circuit_type = connection
.fri_prover_jobs_dal()
.min_unproved_l1_batch_number()
Expand Down
Loading