Skip to content

Commit 8bb976a

Browse files
authored
feat(metrics): refine block_transaction_count buckets, add changelog (#6730)
1 parent 7ef62a7 commit 8bb976a

2 files changed

Lines changed: 95 additions & 1 deletion

File tree

METRICS_CHANGELOG.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
Metrics Changelog
2+
=================
3+
4+
This file tracks Prometheus metric additions, changes, and removals in java-tron. For the full set of metrics emitted today, see the references at the bottom.
5+
6+
**4.8.2**
7+
8+
### New Metrics
9+
10+
#### Core
11+
12+
- `tron:block_transaction_count` (Histogram, label `miner`) — per-block transaction count, sampled at the entry of `Manager#pushBlock` before any early return so duplicate, stale, and fork-switched pushes are observed alongside applied blocks. Primary use cases: empty-block detection per super representative, and per-SR TPS / throughput percentile interpolation. Default buckets `[0, 20, 50, 80, 100, 120, 140, 160, 180, 200, 230, 260, 300, 500, 2000, 5000, 10000]` are densified around 0–300 for percentile interpolation in the typical TPS range; 5000 and 10000 are retained as safety-net buckets to preserve resolution for outlier events such as stress tests or repush storms. ([#6624](https://github.com/tronprotocol/java-tron/pull/6624))
13+
14+
> **Operational note:** The effective upper bound is 10000; blocks exceeding that land in `+Inf`. Monitor the overflow ratio — e.g. `(rate(tron_block_transaction_count_bucket{le="+Inf"}[5m]) - rate(tron_block_transaction_count_bucket{le="10000"}[5m])) / rate(tron_block_transaction_count_count[5m]) > 0.01` — as a signal to re-tune the upper bound.
15+
16+
#### Consensus
17+
18+
- `tron:sr_set_change` (Counter, labels `action`, `witness`) — incremented once per witness whenever the active SR set rotates at a maintenance boundary. `action` is one of `add` / `remove`. Cardinality grows with the number of distinct witnesses that have ever entered or left the active set, not with the active set size at any given moment. ([#6624](https://github.com/tronprotocol/java-tron/pull/6624))
19+
20+
**Pre-4.8.2 Baseline**
21+
22+
Snapshot of metrics emitted prior to this changelog. Per-version provenance is not tracked here; consult `git log` on [`common/src/main/java/org/tron/common/prometheus/`](common/src/main/java/org/tron/common/prometheus/) for exact origin of each metric.
23+
24+
### Existing Metrics
25+
26+
#### Core (block / transaction processing)
27+
28+
- `tron:header_height` (Gauge) — latest block height on this node.
29+
- `tron:header_time` (Gauge) — latest block timestamp on this node.
30+
- `tron:block_push_latency_seconds` (Histogram) — `Manager#pushBlock` latency.
31+
- `tron:block_process_latency_seconds` (Histogram, label `sync`) — `TronNetDelegate#processBlock` latency.
32+
- `tron:block_generate_latency_seconds` (Histogram, label `address`) — block generation latency per producer.
33+
- `tron:block_fetch_latency_seconds` (Histogram) — block fetch latency.
34+
- `tron:block_receive_delay_seconds` (Histogram) — `receiveTime - blockTime`.
35+
- `tron:block_fork` (Counter, label `type`) — fork events by type.
36+
- `tron:lock_acquire_latency_seconds` (Histogram, label `type`) — DB / chain lock acquisition latency.
37+
- `tron:miner` (Counter, labels `miner`, `type`) — blocks produced by an SR.
38+
- `tron:miner_latency_seconds` (Histogram, label `miner`) — block mining latency per producer.
39+
- `tron:miner_delay_seconds` (Histogram, label `miner`) — `actualTime - planTime` for block production.
40+
- `tron:txs` (Counter, labels `type`, `detail`) — transaction counts.
41+
- `tron:process_transaction_latency_seconds` (Histogram, labels `type`, `contract`) — transaction processing latency.
42+
- `tron:verify_sign_latency_seconds` (Histogram, label `type`) — signature verification latency for transactions and blocks.
43+
- `tron:tx_cache` (Gauge, label `type`) — transaction cache stats.
44+
- `tron:manager_queue_size` (Gauge, label `type`) — `Manager` queue sizes (pending / popped / queued / repush).
45+
46+
#### Net (P2P)
47+
48+
- `tron:peers` (Gauge, label `type`) — peer counts.
49+
- `tron:p2p_error` (Counter, label `type`) — P2P error events.
50+
- `tron:p2p_disconnect` (Counter, label `type`) — P2P disconnect events.
51+
- `tron:ping_pong_latency_seconds` (Histogram) — peer ping-pong RTT.
52+
- `tron:message_process_latency_seconds` (Histogram, label `type`) — peer message processing latency.
53+
- `tron:tcp_bytes` (Histogram, label `type`) — TCP traffic.
54+
- `tron:udp_bytes` (Histogram, label `type`) — UDP traffic.
55+
56+
#### API
57+
58+
- `tron:http_service_latency_seconds` (Histogram, label `url`) — HTTP endpoint latency.
59+
- `tron:http_bytes` (Histogram, labels `url`, `status`) — HTTP traffic.
60+
- `tron:grpc_service_latency_seconds` (Histogram, label `endpoint`) — gRPC endpoint latency.
61+
- `tron:jsonrpc_service_latency_seconds` (Histogram, label `method`) — JSON-RPC method latency.
62+
- `tron:internal_service_latency_seconds` (Histogram, labels `class`, `method`) — internal service-call latency.
63+
- `tron:internal_service_fail` (Counter, labels `class`, `method`) — internal service-call failure count.
64+
65+
#### DB
66+
67+
- `tron:db_size_bytes` (Gauge, labels `type`, `db`, `level`) — storage size in bytes per engine, database, and level; `type` is the storage engine (`LEVELDB` or `ROCKSDB`) depending on node configuration.
68+
- `tron:db_sst_level` (Gauge, labels `type`, `db`, `level`) — SST files per compaction level per engine and database; `type` is the storage engine (`LEVELDB` or `ROCKSDB`) depending on node configuration.
69+
- `tron:guava_cache_hit_rate` (Gauge, label `type`) — hit rate of a Guava cache; `type` is the cache name.
70+
- `tron:guava_cache_request` (Gauge, label `type`) — total request count of a Guava cache; `type` is the cache name.
71+
- `tron:guava_cache_eviction_count` (Gauge, label `type`) — eviction count of a Guava cache; `type` is the cache name.
72+
- (Registered via `GuavaCacheExports` for caches that opt in to `CacheManager`.)
73+
74+
#### Logging
75+
76+
- `tron:error_info` (Counter, labels `topic`, `type`) — incremented on every ERROR-level log line by `InstrumentedAppender`.
77+
78+
#### System
79+
80+
Emitted by `OperatingSystemExports` (no labels):
81+
82+
- `system_available_cpus`, `process_cpu_load`, `system_cpu_load`, `system_load_average`, `system_total_physical_memory_bytes`, `system_free_physical_memory_bytes`, `system_total_swap_spaces_bytes`, `system_free_swap_spaces_bytes`.
83+
84+
#### JVM / process
85+
86+
Auto-emitted by the Prometheus client library via `DefaultExports.initialize()` (`simpleclient_hotspot`). The full list is owned by the upstream library and not enumerated here; see the [client_java](https://github.com/prometheus/client_java) docs. Common ones: `jvm_memory_bytes_*`, `jvm_gc_collection_seconds_*`, `jvm_threads_*`, `process_cpu_seconds_total`, `process_open_fds`, `process_resident_memory_bytes`.
87+
88+
---
89+
90+
**References**
91+
92+
- [Official metrics documentation](https://tronprotocol.github.io/documentation-en/using_javatron/metrics/) — descriptions, configuration, and example queries.
93+
- [tron-docker `metric_monitor/README.md`](https://github.com/tronprotocol/tron-docker/blob/main/metric_monitor/README.md) — operator-oriented overview with deployment guidance.
94+
- [java-tron-server Grafana dashboard](https://github.com/tronprotocol/tron-docker/blob/main/metric_monitor/grafana_dashboard/java-tron-server.json) — maintained reference dashboard JSON.

common/src/main/java/org/tron/common/prometheus/MetricsHistogram.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public class MetricsHistogram {
5151

5252
init(MetricKeys.Histogram.BLOCK_TRANSACTION_COUNT,
5353
"Distribution of transaction counts per block.",
54-
new double[]{0, 10, 50, 100, 200, 500, 1000, 2000, 5000, 10000},
54+
new double[]{0, 20, 50, 80, 100, 120, 140, 160, 180, 200, 230, 260, 300, 500, 2000, 5000, 10000},
5555
MetricLabels.Histogram.MINER);
5656
}
5757

0 commit comments

Comments
 (0)