From 7fd97f2a6184ecc3efb794af38399da0d24cd3eb Mon Sep 17 00:00:00 2001 From: warku123 Date: Tue, 14 Apr 2026 14:46:14 +0800 Subject: [PATCH 1/4] feat(dashboard): add block transaction count and SR set change panels Add two new panel sections to the java-tron-server Grafana dashboard to support metrics from tronprotocol/java-tron#6624: - Block Metrics: empty block rate, per-SR empty block count, avg transactions per block, transaction count distribution - SR Set Change: event table and cumulative totals by action --- .../grafana_dashboard/java-tron-server.json | 662 +++++++++++++++++- 1 file changed, 661 insertions(+), 1 deletion(-) diff --git a/metric_monitor/grafana_dashboard/java-tron-server.json b/metric_monitor/grafana_dashboard/java-tron-server.json index b37e26cf..160812bc 100644 --- a/metric_monitor/grafana_dashboard/java-tron-server.json +++ b/metric_monitor/grafana_dashboard/java-tron-server.json @@ -2508,13 +2508,673 @@ "type": "row" }, { - "collapsed": false, + "collapsed": true, "gridPos": { "h": 1, "w": 24, "x": 0, "y": 19 }, + "id": 110, + "panels": [ + { + "datasource": "${datasource}", + "description": "Ratio of blocks with zero transactions over total blocks.", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 20, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "smooth", + "lineWidth": 2, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "percentunit", + "max": 1, + "min": 0 + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 20 + }, + "id": 111, + "options": { + "legend": { + "calcs": [ + "mean", + "max" + ], + "displayMode": "table", + "placement": "bottom" + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "exemplar": true, + "expr": "rate(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"0.0\"}[$__interval]) / ignoring(le) rate(tron:block_transaction_count_count{group=`$group`,instance=`$instance`}[$__interval])", + "legendFormat": "{{miner}}", + "refId": "A" + } + ], + "title": "Empty Block Rate", + "type": "timeseries" + }, + { + "datasource": "${datasource}", + "description": "Number of empty blocks per SR in the last 1 hour.", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "Empty Blocks", + "axisPlacement": "auto", + "fillOpacity": 80, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineWidth": 1, + "scaleDistribution": { + "type": "linear" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 20 + }, + "id": 112, + "options": { + "legend": { + "calcs": [ + "sum" + ], + "displayMode": "table", + "placement": "bottom" + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "exemplar": true, + "expr": "round(increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"0.0\"}[1h]))", + "instant": true, + "legendFormat": "{{miner}}", + "refId": "A" + } + ], + "title": "Per-SR Empty Block Count (1h)", + "type": "barchart" + }, + { + "datasource": "${datasource}", + "description": "Average number of transactions per block.", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "Avg TXs / Block", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "line", + "fillOpacity": 10, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineInterpolation": "smooth", + "lineWidth": 2, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "none" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short", + "min": 0 + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 28 + }, + "id": 113, + "options": { + "legend": { + "calcs": [ + "mean", + "max" + ], + "displayMode": "table", + "placement": "bottom" + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "exemplar": true, + "expr": "rate(tron:block_transaction_count_sum{group=`$group`,instance=`$instance`}[$__interval]) / rate(tron:block_transaction_count_count{group=`$group`,instance=`$instance`}[$__interval])", + "legendFormat": "{{miner}}", + "refId": "A" + } + ], + "title": "Avg Transactions per Block", + "type": "timeseries" + }, + { + "datasource": "${datasource}", + "description": "Distribution of transaction counts per block across histogram buckets.", + "fieldConfig": { + "defaults": { + "color": { + "mode": "palette-classic" + }, + "custom": { + "axisBorderShow": false, + "axisCenteredZero": false, + "axisColorMode": "text", + "axisLabel": "Blocks", + "axisPlacement": "auto", + "barAlignment": 0, + "drawStyle": "bars", + "fillOpacity": 80, + "gradientMode": "none", + "hideFrom": { + "legend": false, + "tooltip": false, + "viz": false + }, + "lineWidth": 1, + "pointSize": 5, + "scaleDistribution": { + "type": "linear" + }, + "showPoints": "never", + "spanNulls": false, + "stacking": { + "group": "A", + "mode": "normal" + }, + "thresholdsStyle": { + "mode": "off" + } + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + }, + "unit": "short" + }, + "overrides": [] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 28 + }, + "id": 114, + "options": { + "legend": { + "calcs": [ + "sum" + ], + "displayMode": "table", + "placement": "bottom" + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "targets": [ + { + "exemplar": true, + "expr": "round(increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"0.0\"}[$__interval]))", + "legendFormat": "0 (empty)", + "refId": "A" + }, + { + "exemplar": true, + "expr": "round(increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"10.0\"}[$__interval]) - increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"0.0\"}[$__interval]))", + "legendFormat": "1-10", + "refId": "B" + }, + { + "exemplar": true, + "expr": "round(increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"50.0\"}[$__interval]) - increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"10.0\"}[$__interval]))", + "legendFormat": "11-50", + "refId": "C" + }, + { + "exemplar": true, + "expr": "round(increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"100.0\"}[$__interval]) - increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"50.0\"}[$__interval]))", + "legendFormat": "51-100", + "refId": "D" + }, + { + "exemplar": true, + "expr": "round(increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"200.0\"}[$__interval]) - increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"100.0\"}[$__interval]))", + "legendFormat": "101-200", + "refId": "E" + }, + { + "exemplar": true, + "expr": "round(increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"500.0\"}[$__interval]) - increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"200.0\"}[$__interval]))", + "legendFormat": "201-500", + "refId": "F" + }, + { + "exemplar": true, + "expr": "round(increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"1000.0\"}[$__interval]) - increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"500.0\"}[$__interval]))", + "legendFormat": "501-1000", + "refId": "G" + }, + { + "exemplar": true, + "expr": "round(increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"+Inf\"}[$__interval]) - increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"1000.0\"}[$__interval]))", + "legendFormat": "1000+", + "refId": "H" + } + ], + "title": "Block Transaction Count Distribution", + "type": "timeseries" + } + ], + "title": "Block Metrics", + "type": "row" + }, + { + "collapsed": true, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 20 + }, + "id": 115, + "panels": [ + { + "datasource": "${datasource}", + "description": "Table of SR set change events showing additions and removals.", + "fieldConfig": { + "defaults": { + "custom": { + "align": "auto", + "cellOptions": { + "type": "auto" + }, + "inspect": false + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + } + ] + } + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "action" + }, + "properties": [ + { + "id": "custom.width", + "value": 80 + }, + { + "id": "mappings", + "value": [ + { + "type": "value", + "options": { + "add": { + "text": "ADD", + "color": "green" + }, + "remove": { + "text": "REMOVE", + "color": "red" + } + } + } + ] + }, + { + "id": "custom.cellOptions", + "value": { + "type": "color-text" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "witness" + }, + "properties": [ + { + "id": "custom.width", + "value": 360 + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Value" + }, + "properties": [ + { + "id": "custom.width", + "value": 80 + }, + { + "id": "displayName", + "value": "Count" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Time" + }, + "properties": [ + { + "id": "custom.width", + "value": 200 + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 0, + "y": 21 + }, + "id": 116, + "options": { + "showHeader": true, + "sortBy": [ + { + "displayName": "Time", + "desc": true + } + ], + "cellHeight": "sm", + "footer": { + "show": false + } + }, + "targets": [ + { + "exemplar": true, + "expr": "tron:sr_set_change_total{group=`$group`,instance=`$instance`}", + "format": "table", + "instant": true, + "refId": "A" + } + ], + "transformations": [ + { + "id": "organize", + "options": { + "excludeByName": { + "__name__": true, + "group": true, + "instance": true, + "job": true + }, + "indexByName": { + "Time": 0, + "action": 1, + "witness": 2, + "Value": 3 + } + } + } + ], + "title": "SR Set Change Events", + "type": "table" + }, + { + "datasource": "${datasource}", + "description": "Cumulative count of SR additions and removals.", + "fieldConfig": { + "defaults": { + "color": { + "mode": "thresholds" + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "yellow", + "value": 5 + }, + { + "color": "red", + "value": 10 + } + ] + }, + "unit": "short" + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "SR Removed" + }, + "properties": [ + { + "id": "thresholds", + "value": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "orange", + "value": 5 + }, + { + "color": "red", + "value": 10 + } + ] + } + } + ] + } + ] + }, + "gridPos": { + "h": 8, + "w": 12, + "x": 12, + "y": 21 + }, + "id": 117, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "horizontal", + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "textMode": "auto", + "wideLayout": true + }, + "targets": [ + { + "exemplar": true, + "expr": "sum(tron:sr_set_change_total{group=`$group`,instance=`$instance`,action=\"add\"}) or vector(0)", + "legendFormat": "SR Added", + "refId": "A" + }, + { + "exemplar": true, + "expr": "sum(tron:sr_set_change_total{group=`$group`,instance=`$instance`,action=\"remove\"}) or vector(0)", + "legendFormat": "SR Removed", + "refId": "B" + } + ], + "title": "SR Set Change Total", + "type": "stat" + } + ], + "title": "SR Set Change", + "type": "row" + }, + { + "collapsed": false, + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 21 + }, "id": 46, "panels": [], "title": "Net", From 7096913caa900548097e4ef89d9d32209f12aa43 Mon Sep 17 00:00:00 2001 From: warku123 Date: Tue, 28 Apr 2026 15:11:56 +0800 Subject: [PATCH 2/4] docs(metrics): document block_transaction_count and sr_set_change Add descriptions for the new metrics under "Blockchain status" and "Block status" sections so node operators can discover and use them. --- metric_monitor/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/metric_monitor/README.md b/metric_monitor/README.md index acde6142..d7f688b7 100644 --- a/metric_monitor/README.md +++ b/metric_monitor/README.md @@ -90,6 +90,7 @@ The TRON node metrics can be viewed through the Grafana dashboard or directly at - `tron:header_time`: The latest block time of java-tron on this node - `tron:header_height`: The latest block height of java-tron on this node - `tron:miner_total`: Used to display the blocks produced by a certain SR +- `tron:sr_set_change_total`: Counter of SR set membership changes detected at each maintenance time interval. Labels: `action` (`add`/`remove`), `witness` (SR address). Useful for tracking governance and consensus participant rotation. ### Node system status Metric of specific container: @@ -146,6 +147,11 @@ Verify the latency of all transactions' signatures when processing a block: - `tron:verify_sign_latency_seconds_count`: Count of events - `tron:verify_sign_latency_seconds_sum`: Total sum of all observed values +Histogram of transaction count per block, with buckets `[0, 10, 50, 100, 200, 500, 1000, 2000, 5000, 10000]`. Empty blocks can be queried via the `le="0.0"` bucket; the distribution buckets enable transaction volume analysis (P50/P99, large-block ratio, etc.): +- `tron:block_transaction_count_bucket`: Cumulative counters per bucket. Label: `miner` (SR address). +- `tron:block_transaction_count_count`: Count of observed blocks +- `tron:block_transaction_count_sum`: Total sum of all observed transaction counts + Check the usage from dashboard panel (enter edit mode), or by searching in [grafana_dashboard_tron_server.json](grafana_dashboard/grafana_dashboard_tron_server.json). ![image](../images/metric_block_latency.png) From f9325c71f7d26760d6cd762cac71bff6f687d5ad Mon Sep 17 00:00:00 2001 From: warku123 Date: Wed, 6 May 2026 11:49:55 +0800 Subject: [PATCH 3/4] feat(dashboard): align tx count distribution with refined buckets The block_transaction_count histogram buckets in java-tron are being refined to [0, 20, 50, 80, 100, 120, 140, 160, 180, 200, 230, 260, 300, 500, 2000] (tronprotocol/java-tron#6730), densifying the 0-300 range for percentile interpolation in the typical per-SR TPS range. Update the Block Transaction Count Distribution panel to match: the old le="10.0" and le="1000.0" boundaries no longer exist in the refined array, so those queries would return nothing. Adopt 9 legend buckets aligned to the new boundaries (0, 1-20, 21-50, 51-100, 101-200, 201-300, 301-500, 501-2000, 2000+) so the panel makes use of the added 0-300 resolution. --- .../grafana_dashboard/java-tron-server.json | 26 ++++++++++++------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/metric_monitor/grafana_dashboard/java-tron-server.json b/metric_monitor/grafana_dashboard/java-tron-server.json index 160812bc..30af6798 100644 --- a/metric_monitor/grafana_dashboard/java-tron-server.json +++ b/metric_monitor/grafana_dashboard/java-tron-server.json @@ -2854,14 +2854,14 @@ }, { "exemplar": true, - "expr": "round(increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"10.0\"}[$__interval]) - increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"0.0\"}[$__interval]))", - "legendFormat": "1-10", + "expr": "round(increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"20.0\"}[$__interval]) - increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"0.0\"}[$__interval]))", + "legendFormat": "1-20", "refId": "B" }, { "exemplar": true, - "expr": "round(increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"50.0\"}[$__interval]) - increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"10.0\"}[$__interval]))", - "legendFormat": "11-50", + "expr": "round(increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"50.0\"}[$__interval]) - increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"20.0\"}[$__interval]))", + "legendFormat": "21-50", "refId": "C" }, { @@ -2878,21 +2878,27 @@ }, { "exemplar": true, - "expr": "round(increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"500.0\"}[$__interval]) - increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"200.0\"}[$__interval]))", - "legendFormat": "201-500", + "expr": "round(increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"300.0\"}[$__interval]) - increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"200.0\"}[$__interval]))", + "legendFormat": "201-300", "refId": "F" }, { "exemplar": true, - "expr": "round(increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"1000.0\"}[$__interval]) - increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"500.0\"}[$__interval]))", - "legendFormat": "501-1000", + "expr": "round(increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"500.0\"}[$__interval]) - increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"300.0\"}[$__interval]))", + "legendFormat": "301-500", "refId": "G" }, { "exemplar": true, - "expr": "round(increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"+Inf\"}[$__interval]) - increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"1000.0\"}[$__interval]))", - "legendFormat": "1000+", + "expr": "round(increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"2000.0\"}[$__interval]) - increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"500.0\"}[$__interval]))", + "legendFormat": "501-2000", "refId": "H" + }, + { + "exemplar": true, + "expr": "round(increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"+Inf\"}[$__interval]) - increase(tron:block_transaction_count_bucket{group=`$group`,instance=`$instance`,le=\"2000.0\"}[$__interval]))", + "legendFormat": "2000+", + "refId": "I" } ], "title": "Block Transaction Count Distribution", From ad334cb3c8edeba22e2d6e8d59a90bec1e7b72bc Mon Sep 17 00:00:00 2001 From: warku123 Date: Wed, 6 May 2026 11:59:12 +0800 Subject: [PATCH 4/4] docs(metric_monitor): align tx count buckets with java-tron Update the documented bucket array for tron:block_transaction_count to match the refined buckets in tronprotocol/java-tron#6730: [0, 20, 50, 80, 100, 120, 140, 160, 180, 200, 230, 260, 300, 500, 2000]. Per @Sunny6889's review on this PR. --- metric_monitor/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/metric_monitor/README.md b/metric_monitor/README.md index d7f688b7..68fb64f3 100644 --- a/metric_monitor/README.md +++ b/metric_monitor/README.md @@ -147,7 +147,7 @@ Verify the latency of all transactions' signatures when processing a block: - `tron:verify_sign_latency_seconds_count`: Count of events - `tron:verify_sign_latency_seconds_sum`: Total sum of all observed values -Histogram of transaction count per block, with buckets `[0, 10, 50, 100, 200, 500, 1000, 2000, 5000, 10000]`. Empty blocks can be queried via the `le="0.0"` bucket; the distribution buckets enable transaction volume analysis (P50/P99, large-block ratio, etc.): +Histogram of transaction count per block, with buckets `[0, 20, 50, 80, 100, 120, 140, 160, 180, 200, 230, 260, 300, 500, 2000]` (densified around 0–300 for percentile interpolation in the typical per-SR TPS range). Empty blocks can be queried via the `le="0.0"` bucket; the distribution buckets enable transaction volume analysis (P50/P99, large-block ratio, etc.): - `tron:block_transaction_count_bucket`: Cumulative counters per bucket. Label: `miner` (SR address). - `tron:block_transaction_count_count`: Count of observed blocks - `tron:block_transaction_count_sum`: Total sum of all observed transaction counts