metrics.rs

Overview

This file defines metrics instrumentation for monitoring components related to block management and asynchronous runtime behavior within the system. It utilizes the opentelemetry crate for metric collection and reporting, specifically focusing on gauge metrics for tracking numeric values that can go up or down over time. Additionally, it integrates Tokio runtime metrics through the TokioMetrics struct from the telemetry_utils crate.

The primary purpose of this file is to encapsulate metric definitions and reporting methods that facilitate observability of block finalization progress and Tokio runtime status, enabling performance analysis and operational monitoring.


Structs and Their Functionality

BlockManagerMetrics

Represents metrics specific to the block management subsystem.

Fields:

Methods:


Metrics

Acts as a container for all metric categories used by the system, currently including block manager metrics and Tokio runtime metrics.

Fields:

Methods:


Important Implementation Details


Interactions with Other System Components


Visual Diagram of File Structure

classDiagram
class Metrics {
+bm: BlockManagerMetrics
+tokio: TokioMetrics
+new()
}
class BlockManagerMetrics {
-last_finalized_seqno: Gauge<u64>
+new()
+report_last_finalized_seqno()
}
Metrics --> BlockManagerMetrics
Metrics --> TokioMetrics

This diagram shows the Metrics struct as a container aggregating two metric categories: BlockManagerMetrics and TokioMetrics. The BlockManagerMetrics struct encapsulates a gauge metric and methods to create and report it. The arrow indicates aggregation relationships.