-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Background
Currently, java-tron's Prometheus metrics provide comprehensive monitoring for transactions, blocks, P2P connections, and consensus status. However, there are two important operational aspects that lack visibility:
-
Empty Block Detection: There is no metric to track blocks that contain no transactions. Monitoring empty blocks is crucial for identifying potential network issues, misconfigured witness nodes, or degraded transaction throughput.
-
Super Representative (SR) Set Changes: The active witness set changes during maintenance periods when new SRs are elected or removed. Currently, there is no way to track these changes through metrics, making it difficult to monitor consensus layer dynamics and SR rotation events.
Problem Statement & Rationale
- Node operators cannot identify which witness nodes are producing empty blocks, making it difficult to diagnose network health issues
- There is no real-time visibility into SR set changes
What are the use cases?
- Identify witnesses producing excessive empty blocks
- Monitor SR election results and consensus transitions
Proposed Solution
Add two new Prometheus counters to track empty blocks and SR set changes:
tron:block_empty_total- Tracks empty blockstron:sr_set_change_total- Tracks SR set changes (add/remove)
Testing Strategy
Test Scenarios
- Unit Test: Add unit test about two counters.
- Manual Test: Build a private chain and test the case include produce empty and SR set change.
Scope of Impact
- Other: Metrics/Monitoring system
Backward Compatibility
Fully backward compatible. Existing metrics remain unchanged. New metrics are opt-in via Prometheus scraping.
Implementation
Do you have ideas regarding the implementation?
The implementation involves:
-
Metric Registration: Add new counter definitions in
MetricKeys.java,MetricLabels.java, andMetricsCounter.java -
BlockChainMetricManager Modifications: In
BlockChainMetricManager.java:- Add empty block detection logic
- Add SR set change detection logic
-
Testing: Extend
PrometheusApiServiceTestto cover new metrics functionality
Are you willing to implement this feature?
- Yes, I can implement this feature
Estimated Complexity
- Medium (moderate changes)
References