Skip to content
This repository was archived by the owner on Jan 16, 2026. It is now read-only.
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
5 changes: 5 additions & 0 deletions crates/node/service/src/actors/sequencer/actor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use crate::{
metrics::{
update_attributes_build_duration_metrics, update_block_build_duration_metrics,
update_conductor_commitment_duration_metrics, update_seal_duration_metrics,
update_total_transactions_sequenced,
},
origin_selector::OriginSelector,
},
Expand Down Expand Up @@ -151,6 +152,10 @@ where

update_seal_duration_metrics(seal_request_start.elapsed());

let payload_transaction_count =
unsealed_payload_handle.attributes_with_parent.count_transactions();
update_total_transactions_sequenced(payload_transaction_count);

// If the conductor is available, commit the payload to it.
if let Some(conductor) = &self.conductor {
let _conductor_commitment_start = Instant::now();
Expand Down
7 changes: 7 additions & 0 deletions crates/node/service/src/actors/sequencer/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,10 @@ pub(super) fn update_seal_duration_metrics(duration: Duration) {
// Log the block building seal task duration, if metrics are enabled.
kona_macros::set!(gauge, crate::Metrics::SEQUENCER_BLOCK_BUILDING_SEAL_TASK_DURATION, duration);
}

#[inline]
pub(super) fn update_total_transactions_sequenced(transaction_count: u64) {
#[cfg(feature = "metrics")]
metrics::counter!(crate::Metrics::SEQUENCER_TOTAL_TRANSACTIONS_SEQUENCED)
.increment(transaction_count);
}
14 changes: 14 additions & 0 deletions crates/node/service/src/metrics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ impl Metrics {
pub const SEQUENCER_CONDUCTOR_COMMITMENT_DURATION: &str =
"kona_node_sequencer_conductor_commitment_duration";

/// Total number of transactions of sequenced by sequencer.
pub const SEQUENCER_TOTAL_TRANSACTIONS_SEQUENCED: &str =
"kona_node_sequencer_total_transactions_sequenced";

/// Initializes metrics for the node service.
///
/// This does two things:
Expand Down Expand Up @@ -85,6 +89,13 @@ impl Metrics {
Self::SEQUENCER_CONDUCTOR_COMMITMENT_DURATION,
"Duration of the sequencer conductor commitment"
);

// Sequencer total transactions sequenced
metrics::describe_counter!(
Self::SEQUENCER_TOTAL_TRANSACTIONS_SEQUENCED,
metrics::Unit::Count,
"Total count of sequenced transactions"
);
}

/// Initializes metrics to `0` so they can be queried immediately by consumers of prometheus
Expand All @@ -96,5 +107,8 @@ impl Metrics {

// Derivation critical error
kona_macros::set!(counter, Self::DERIVATION_CRITICAL_ERROR, 0);

// Sequencer: reset total transactions sequenced
kona_macros::set!(counter, Self::SEQUENCER_TOTAL_TRANSACTIONS_SEQUENCED, 0);
}
}
5 changes: 5 additions & 0 deletions crates/protocol/protocol/src/attributes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ impl OpAttributesWithParent {
is_last_in_span: self.is_last_in_span,
}
}

/// Returns the number of transactions in the attributes.
pub fn count_transactions(&self) -> u64 {
self.attributes().decoded_transactions().count().try_into().unwrap()
}
}

#[cfg(test)]
Expand Down
Loading