Skip to content

Commit

Permalink
feat: set stage resets to 0 at construction
Browse files Browse the repository at this point in the history
  • Loading branch information
refcell committed Jul 18, 2024
1 parent a71da5f commit b658650
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crates/derive/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,8 @@ macro_rules! set {
#[cfg(feature = "metrics")]
$crate::metrics::$metric.set($value);
};
($metric:ident, $value:expr, $labels:expr) => {
#[cfg(feature = "metrics")]
$crate::metrics::$metric.with_label_values($labels).set($value as f64);
};
}
1 change: 1 addition & 0 deletions crates/derive/src/stages/attributes_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ where
{
/// Create a new [AttributesQueue] stage.
pub fn new(cfg: Arc<RollupConfig>, prev: P, builder: AB) -> Self {
crate::set!(STAGE_RESETS, 0, &["attributes-queue"]);
Self { cfg, prev, is_last_in_span: false, batch: None, builder }
}

Expand Down
1 change: 1 addition & 0 deletions crates/derive/src/stages/batch_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ where
{
/// Creates a new [BatchQueue] stage.
pub fn new(cfg: Arc<RollupConfig>, prev: P, fetcher: BF) -> Self {
crate::set!(STAGE_RESETS, 0, &["batch-queue"]);
Self {
cfg,
prev,
Expand Down
1 change: 1 addition & 0 deletions crates/derive/src/stages/channel_bank.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ where
{
/// Create a new [ChannelBank] stage.
pub fn new(cfg: Arc<RollupConfig>, prev: P) -> Self {
crate::set!(STAGE_RESETS, 0, &["channel-bank"]);
Self { cfg, channels: HashMap::new(), channel_queue: VecDeque::new(), prev }
}

Expand Down
1 change: 1 addition & 0 deletions crates/derive/src/stages/channel_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ where
{
/// Create a new [ChannelReader] stage.
pub fn new(prev: P, cfg: Arc<RollupConfig>) -> Self {
crate::set!(STAGE_RESETS, 0, &["channel-reader"]);
Self { prev, next_batch: None, cfg: cfg.clone() }
}

Expand Down
1 change: 1 addition & 0 deletions crates/derive/src/stages/frame_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ where
///
/// [L1Retrieval]: crate::stages::L1Retrieval
pub fn new(prev: P) -> Self {
crate::set!(STAGE_RESETS, 0, &["frame-queue"]);
Self { prev, queue: VecDeque::new() }
}
}
Expand Down
1 change: 1 addition & 0 deletions crates/derive/src/stages/l1_retrieval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ where
///
/// [L1Traversal]: crate::stages::L1Traversal
pub fn new(prev: P, provider: DAP) -> Self {
crate::set!(STAGE_RESETS, 0, &["l1-retrieval"]);
Self { prev, provider, data: None }
}
}
Expand Down
1 change: 1 addition & 0 deletions crates/derive/src/stages/l1_traversal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ impl<F: ChainProvider + Send> L1RetrievalProvider for L1Traversal<F> {
impl<F: ChainProvider> L1Traversal<F> {
/// Creates a new [L1Traversal] instance.
pub fn new(data_source: F, cfg: Arc<RollupConfig>) -> Self {
crate::set!(STAGE_RESETS, 0, &["l1-traversal"]);
Self {
block: Some(BlockInfo::default()),
data_source,
Expand Down

0 comments on commit b658650

Please sign in to comment.