From aebfb2901894fa13a3b3460492afb61fd3943335 Mon Sep 17 00:00:00 2001 From: bigbear <155267841+aso20455@users.noreply.github.com> Date: Tue, 23 Dec 2025 17:02:05 +0100 Subject: [PATCH 1/3] Update channel_assembler.rs --- .../src/stages/channel/channel_assembler.rs | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/crates/protocol/derive/src/stages/channel/channel_assembler.rs b/crates/protocol/derive/src/stages/channel/channel_assembler.rs index 248149bd9d..0184f321d4 100644 --- a/crates/protocol/derive/src/stages/channel/channel_assembler.rs +++ b/crates/protocol/derive/src/stages/channel/channel_assembler.rs @@ -94,14 +94,21 @@ where self.channel = Some(Channel::new(next_frame.id, origin)); } - let count = if self.channel.is_some() { 1 } else { 0 }; - kona_macros::set!(gauge, crate::metrics::Metrics::PIPELINE_CHANNEL_BUFFER, count); + #[cfg(feature = "metrics")] + { + let count = if self.channel.is_some() { 1 } else { 0 }; + kona_macros::set!(gauge, crate::metrics::Metrics::PIPELINE_CHANNEL_BUFFER, count); + } if let Some(channel) = self.channel.as_mut() { // Track the number of blocks until the channel times out. - let timeout = channel.open_block_number() + self.cfg.channel_timeout(origin.timestamp); - let margin = timeout.saturating_sub(origin.number) as f64; - kona_macros::set!(gauge, crate::metrics::Metrics::PIPELINE_CHANNEL_TIMEOUT, margin); + #[cfg(feature = "metrics")] + { + let timeout = + channel.open_block_number() + self.cfg.channel_timeout(origin.timestamp); + let margin = timeout.saturating_sub(origin.number) as f64; + kona_macros::set!(gauge, crate::metrics::Metrics::PIPELINE_CHANNEL_TIMEOUT, margin); + } // Add the frame to the channel. If this fails, return NotEnoughData and discard the // frame. @@ -122,8 +129,11 @@ where return Err(PipelineError::NotEnoughData.temp()); } - let size = channel.size() as f64; - kona_macros::set!(gauge, crate::metrics::Metrics::PIPELINE_CHANNEL_MEM, size); + #[cfg(feature = "metrics")] + { + let size = channel.size() as f64; + kona_macros::set!(gauge, crate::metrics::Metrics::PIPELINE_CHANNEL_MEM, size); + } let max_rlp_bytes_per_channel = if self.cfg.is_fjord_active(origin.timestamp) { MAX_RLP_BYTES_PER_CHANNEL_FJORD From a3b81799cb290591093bc56202ad5b8f568abbe5 Mon Sep 17 00:00:00 2001 From: bigbear <155267841+aso20455@users.noreply.github.com> Date: Tue, 23 Dec 2025 17:02:23 +0100 Subject: [PATCH 2/3] Update channel_reader.rs --- .../src/stages/channel/channel_reader.rs | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/crates/protocol/derive/src/stages/channel/channel_reader.rs b/crates/protocol/derive/src/stages/channel/channel_reader.rs index 48aa0d293b..adf00e5af8 100644 --- a/crates/protocol/derive/src/stages/channel/channel_reader.rs +++ b/crates/protocol/derive/src/stages/channel/channel_reader.rs @@ -121,22 +121,25 @@ where match next_batch.decompress() { Ok(()) => { // Record the decompressed size and type. - let size = next_batch.decompressed.len() as f64; - let ty = if next_batch.brotli_used { - BatchReader::CHANNEL_VERSION_BROTLI - } else { - BatchReader::ZLIB_DEFLATE_COMPRESSION_METHOD - }; - kona_macros::set!( - gauge, - crate::metrics::Metrics::PIPELINE_LATEST_DECOMPRESSED_BATCH_SIZE, - size - ); - kona_macros::set!( - gauge, - crate::metrics::Metrics::PIPELINE_LATEST_DECOMPRESSED_BATCH_TYPE, - ty as f64 - ); + #[cfg(feature = "metrics")] + { + let size = next_batch.decompressed.len() as f64; + let ty = if next_batch.brotli_used { + BatchReader::CHANNEL_VERSION_BROTLI + } else { + BatchReader::ZLIB_DEFLATE_COMPRESSION_METHOD + }; + kona_macros::set!( + gauge, + crate::metrics::Metrics::PIPELINE_LATEST_DECOMPRESSED_BATCH_SIZE, + size + ); + kona_macros::set!( + gauge, + crate::metrics::Metrics::PIPELINE_LATEST_DECOMPRESSED_BATCH_TYPE, + ty as f64 + ); + } } Err(err) => { debug!(target: "channel_reader", ?err, "Failed to decompress batch"); From 69eca8382b963486d191e0fe1fc1097466c6af0f Mon Sep 17 00:00:00 2001 From: bigbear <155267841+aso20455@users.noreply.github.com> Date: Tue, 23 Dec 2025 17:02:54 +0100 Subject: [PATCH 3/3] Update frame_queue.rs --- .../protocol/derive/src/stages/frame_queue.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/crates/protocol/derive/src/stages/frame_queue.rs b/crates/protocol/derive/src/stages/frame_queue.rs index 4a993a65c9..3ea1bc4a3c 100644 --- a/crates/protocol/derive/src/stages/frame_queue.rs +++ b/crates/protocol/derive/src/stages/frame_queue.rs @@ -132,13 +132,16 @@ where self.queue.extend(frames); // Update metrics with last frame count - kona_macros::set!( - gauge, - crate::metrics::Metrics::PIPELINE_FRAME_QUEUE_BUFFER, - self.queue.len() as f64 - ); - let queue_size = self.queue.iter().map(|f| f.size()).sum::() as f64; - kona_macros::set!(gauge, crate::metrics::Metrics::PIPELINE_FRAME_QUEUE_MEM, queue_size); + #[cfg(feature = "metrics")] + { + kona_macros::set!( + gauge, + crate::metrics::Metrics::PIPELINE_FRAME_QUEUE_BUFFER, + self.queue.len() as f64 + ); + let queue_size = self.queue.iter().map(|f| f.size()).sum::() as f64; + kona_macros::set!(gauge, crate::metrics::Metrics::PIPELINE_FRAME_QUEUE_MEM, queue_size); + } // Prune frames if Holocene is active. let origin = self.origin().ok_or(PipelineError::MissingOrigin.crit())?;