Expand description
§Statistics Module
This module collects and manages runtime statistics for the node. It tracks three main categories of statistics that can be queried via RPC endpoints.
§Components
| Sub-module | Purpose |
|---|---|
actions | Tracks action dispatch frequency and timing |
sync | Tracks blockchain synchronization progress |
block_producer | Tracks block production attempts and outcomes |
§Architecture
The Stats struct is held by the Service trait
implementation and is accessed via store.service.stats() in effects.
Statistics are updated during effect execution, not in reducers, since
they are side-effects that don’t affect the core state machine.
§Usage
Statistics are collected in effects throughout the codebase:
- Action stats: Updated in
effects()for every dispatched action - Sync stats: Updated in
transition_frontiereffects during synchronization - Block producer stats: Updated in
block_producer_effectfulduring block production
§RPC Endpoints
Statistics are exposed via RPC for monitoring and debugging. These endpoints are consumed by the frontend dashboard to display node health and performance:
ActionStatsGet- Returns action dispatch statisticsSyncStatsGet- Returns synchronization statisticsBlockProducerStatsGet- Returns block production statistics