feat(metrics): add Prometheus counters for empty blocks and SR set changes#6601
Closed
ToXMon wants to merge 5 commits intotronprotocol:developfrom
Closed
feat(metrics): add Prometheus counters for empty blocks and SR set changes#6601ToXMon wants to merge 5 commits intotronprotocol:developfrom
ToXMon wants to merge 5 commits intotronprotocol:developfrom
Conversation
…monitoring Replace the dedicated tron:block_empty_total counter with a more comprehensive tron:block_transaction_count histogram that tracks the distribution of transaction counts per block. Changes: - Add overloaded init() method in MetricsHistogram to support custom buckets - Add BLOCK_TRANSACTION_COUNT histogram with buckets [0, 10, 50, 100, 200, 500, 1000, 2000, 5000, 10000] - Record transaction count for all blocks (including empty blocks with txCount=0) - Empty blocks can be queried via bucket le=0.0 - Remove unused BLOCK_EMPTY counter - Keep SR_SET_CHANGE counter for SR set change monitoring This provides richer insights for network analysis while still supporting empty block monitoring via histogram bucket queries. Closes tronprotocol#6590
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements Issue #6590 — adds two new Prometheus counters for blockchain monitoring:
tron:block_empty_total— increments when a block with zero transactions is appliedtron:sr_set_change_total— tracks SR set changes with added/removed labelsChanges
New Metrics
tron:block_empty_totaltypetron:sr_set_change_totalwitness,change_typeFiles Modified
common/src/main/java/org/tron/common/prometheus/MetricKeys.java— counter constantscommon/src/main/java/org/tron/common/prometheus/MetricLabels.java— label valuescommon/src/main/java/org/tron/common/prometheus/MetricsCounter.java— counter registrationframework/src/main/java/org/tron/core/metrics/blockchain/BlockChainMetricManager.java— detection logicframework/src/test/java/org/tron/core/metrics/prometheus/PrometheusApiServiceTest.java— unit testsTesting
testEmptyBlockMetric()— PASSEDtestSrSetChangeMetric()— PASSED./gradlew test— BUILD SUCCESSFULBackward Compatibility
Fully backward compatible. Zero protocol changes, zero API changes, zero config changes.
Closes #6590