|
| 1 | +//! # Statistics Module |
| 2 | +//! |
| 3 | +//! This module collects and manages runtime statistics for the node. It tracks |
| 4 | +//! three main categories of statistics that can be queried via RPC endpoints. |
| 5 | +//! |
| 6 | +//! ## Components |
| 7 | +//! |
| 8 | +//! | Sub-module | Purpose | |
| 9 | +//! |-------------------|------------------------------------------------------| |
| 10 | +//! | [`actions`] | Tracks action dispatch frequency and timing | |
| 11 | +//! | [`sync`] | Tracks blockchain synchronization progress | |
| 12 | +//! | [`block_producer`]| Tracks block production attempts and outcomes | |
| 13 | +//! |
| 14 | +//! ## Architecture |
| 15 | +//! |
| 16 | +//! The [`Stats`] struct is held by the [`Service`](crate::Service) trait |
| 17 | +//! implementation and is accessed via `store.service.stats()` in effects. |
| 18 | +//! Statistics are updated during effect execution, not in reducers, since |
| 19 | +//! they are side-effects that don't affect the core state machine. |
| 20 | +//! |
| 21 | +//! ## Usage |
| 22 | +//! |
| 23 | +//! Statistics are collected in effects throughout the codebase: |
| 24 | +//! |
| 25 | +//! - **Action stats**: Updated in [`effects()`](crate::effects()) for every |
| 26 | +//! dispatched action |
| 27 | +//! - **Sync stats**: Updated in [`transition_frontier`](crate::transition_frontier) |
| 28 | +//! effects during synchronization |
| 29 | +//! - **Block producer stats**: Updated in |
| 30 | +//! [`block_producer_effectful`](crate::block_producer_effectful) during block |
| 31 | +//! production |
| 32 | +//! |
| 33 | +//! ## RPC Endpoints |
| 34 | +//! |
| 35 | +//! Statistics are exposed via RPC for monitoring and debugging. These endpoints |
| 36 | +//! are consumed by the frontend dashboard to display node health and performance: |
| 37 | +//! |
| 38 | +//! - `ActionStatsGet` - Returns action dispatch statistics |
| 39 | +//! - `SyncStatsGet` - Returns synchronization statistics |
| 40 | +//! - `BlockProducerStatsGet` - Returns block production statistics |
| 41 | +
|
1 | 42 | mod stats_actions; |
2 | 43 | pub mod actions { |
3 | 44 | pub use super::stats_actions::*; |
|
0 commit comments