pub struct Metrics;Expand description
Metrics container with constants for Prometheus metric collection.
Contains identifiers for gauges, counters, and histograms used to monitor
engine operations when the metrics feature is enabled. Metrics track:
- Block progression through safety levels (unsafe → finalized)
- Task execution success/failure rates by type
- Engine API method call latencies
§Usage
use metrics::{counter, gauge, histogram};
use kona_engine::Metrics;
// Track successful task execution
counter!(Metrics::ENGINE_TASK_SUCCESS, "task" => Metrics::INSERT_TASK_LABEL);
// Record block height at safety level
gauge!(Metrics::BLOCK_LABELS, block_num as f64, "level" => Metrics::SAFE_BLOCK_LABEL);
// Time Engine API calls
histogram!(Metrics::ENGINE_METHOD_REQUEST_DURATION, duration.as_secs_f64());Implementations§
Source§impl Metrics
impl Metrics
Sourcepub const BLOCK_LABELS: &str = "kona_node_block_labels"
pub const BLOCK_LABELS: &str = "kona_node_block_labels"
Identifier for the gauge that tracks block labels.
Sourcepub const UNSAFE_BLOCK_LABEL: &str = "unsafe"
pub const UNSAFE_BLOCK_LABEL: &str = "unsafe"
Unsafe block label.
Sourcepub const CROSS_UNSAFE_BLOCK_LABEL: &str = "cross-unsafe"
pub const CROSS_UNSAFE_BLOCK_LABEL: &str = "cross-unsafe"
Cross-unsafe block label.
Sourcepub const LOCAL_SAFE_BLOCK_LABEL: &str = "local-safe"
pub const LOCAL_SAFE_BLOCK_LABEL: &str = "local-safe"
Local-safe block label.
Sourcepub const SAFE_BLOCK_LABEL: &str = "safe"
pub const SAFE_BLOCK_LABEL: &str = "safe"
Safe block label.
Sourcepub const FINALIZED_BLOCK_LABEL: &str = "finalized"
pub const FINALIZED_BLOCK_LABEL: &str = "finalized"
Finalized block label.
Sourcepub const ENGINE_TASK_SUCCESS: &str = "kona_node_engine_task_count"
pub const ENGINE_TASK_SUCCESS: &str = "kona_node_engine_task_count"
Identifier for the counter that records engine task counts.
Sourcepub const ENGINE_TASK_FAILURE: &str = "kona_node_engine_task_failure"
pub const ENGINE_TASK_FAILURE: &str = "kona_node_engine_task_failure"
Identifier for the counter that records engine task counts.
Sourcepub const INSERT_TASK_LABEL: &str = "insert"
pub const INSERT_TASK_LABEL: &str = "insert"
Insert task label.
Sourcepub const CONSOLIDATE_TASK_LABEL: &str = "consolidate"
pub const CONSOLIDATE_TASK_LABEL: &str = "consolidate"
Consolidate task label.
Sourcepub const FORKCHOICE_TASK_LABEL: &str = "forkchoice-update"
pub const FORKCHOICE_TASK_LABEL: &str = "forkchoice-update"
Forkchoice task label.
Sourcepub const BUILD_TASK_LABEL: &str = "build"
pub const BUILD_TASK_LABEL: &str = "build"
Build task label.
Sourcepub const FINALIZE_TASK_LABEL: &str = "finalize"
pub const FINALIZE_TASK_LABEL: &str = "finalize"
Finalize task label.
Sourcepub const ENGINE_METHOD_REQUEST_DURATION: &str = "kona_node_engine_method_request_duration"
pub const ENGINE_METHOD_REQUEST_DURATION: &str = "kona_node_engine_method_request_duration"
Identifier for the histogram that tracks engine method call time.
Sourcepub const FORKCHOICE_UPDATE_METHOD: &str = "engine_forkchoiceUpdated"
pub const FORKCHOICE_UPDATE_METHOD: &str = "engine_forkchoiceUpdated"
engine_forkchoiceUpdatedV<N> label
Sourcepub const NEW_PAYLOAD_METHOD: &str = "engine_newPayload"
pub const NEW_PAYLOAD_METHOD: &str = "engine_newPayload"
engine_newPayloadV<N> label.
Sourcepub const GET_PAYLOAD_METHOD: &str = "engine_getPayload"
pub const GET_PAYLOAD_METHOD: &str = "engine_getPayload"
engine_getPayloadV<N> label.
Sourcepub const ENGINE_RESET_COUNT: &str = "kona_node_engine_reset_count"
pub const ENGINE_RESET_COUNT: &str = "kona_node_engine_reset_count"
Identifier for the counter that tracks the number of times the engine has been reset.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Metrics
impl RefUnwindSafe for Metrics
impl Send for Metrics
impl Sync for Metrics
impl Unpin for Metrics
impl UnwindSafe for Metrics
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more