Starting from the GreatVoyage-4.5.1 (Tertullian) version, the node provides a series of interfaces compatible with the Prometheus protocol, allowing the node deployer to monitor the health status of the node more conveniently.
Below, we provide a guide on using metrics to monitor the TRON node status. Then, we list all available metrics.
Please download and install the latest version of Docker from the official Docker website:
Then check the Docker resource settings to ensure it has at least 16GB of memory.
Download the tron-docker
repository, enter the metric
directory, and start the services defined in docker-compose.yml using the following command:
docker-compose up -d
Then check the Docker resource settings to ensure it has at least 16GB of memory. It will start a TRON FullNode that connects to the Mainnet, along with Prometheus and Grafana services. Note that in main_net_config.conf, it contains the configuration below to enable metrics.
metrics{
prometheus{
enable=true
port="9527"
}
}
The Prometheus service will use the configuration file prometheus.yml. It uses the configuration below to add targets for monitoring.
- targets:
- tron_node1:9527 # use container name
labels:
group: group-tron
instance: fullnode-01
You can view the running status of the Prometheus service at http://localhost:9090/
. Click on "Status" -> "Configuration" to check whether the configuration file used by the container is correct.
If you want to monitor more nodes, simply add more targets following the same format. Click on "Status" -> "Targets" to view the status of each monitored java-tron node.
Notice: If you want to check metrics, please use http://localhost:9527/metrics
on host machine instead of http://tron_node1:9527/metrics
, as the latter is used for container access inside Docker.
After startup, you can log in to the Grafana web UI through http://localhost:3000/. The initial username and password are both admin
. After logging in, change the password according to the prompts, and then you can enter the main interface.
Click the Connections on the left side of the main page and select "Data Sources" to configure Grafana data sources. Enter the ip and port of the prometheus service in URL with http://prometheus:9090
.
For the convenience of java-tron node deployers, the TRON community provides a comprehensive dashboard configuration file grafana_dashboard_tron_server.json. Click the Grafana dashboards icon on the left, then select "New" and "Import", then click "Upload JSON file" to import the downloaded dashboard configuration file:
Then you can see the following monitors displaying the running status of the nodes in real time:
Below, we will introduce all supported metrics to facilitate customizing your dashboard.
As you can see from above Grafana dashboard or http://localhost:9527/metrics, the available metrics are categorized into the following:
- Blockchain status
- Node system status
- Block and transaction status
- Network peer status
- API information
- Database information
- JVM status
tron:header_time
: The latest block time of java-tron on this nodetron:header_height
: The latest block height of java-tron on this nodetron:miner_total
: Used to display the blocks produced by a certain SR
Metric of specific container:
process_cpu_load
: Process CPU loadprocess_cpu_seconds_total
process_max_fds
: Maximum number of open file descriptorsprocess_open_fds
: Number of open file descriptorsprocess_resident_memory_bytes
: Resident memory size in bytesprocess_start_time_seconds
: Start time of the process since unix epoch in secondsprocess_virtual_memory_bytes
Metric for docker resources:
system_available_cpus
: System available cpussystem_cpu_load
: System CPU loadsystem_free_physical_memory_bytes
: System free physical memory bytessystem_free_swap_spaces_bytes
: System free swap spacessystem_load_average
: System CPU load averagesystem_total_physical_memory_bytes
: System total physical memory bytessystem_total_swap_spaces_bytes
: System free swap spaces bytes
Follow the example dashboard to add more panels.
Used to check the block process performance from TronNetDelegate:
tron:block_process_latency_seconds_bucket
: Cumulative counterstron:block_process_latency_seconds_count
: Count of eventstron:block_process_latency_seconds_sum
: Total sum of all observed values
Used to check the block processing latency from the Manager, which is invoked by TronNetDelegate:
tron:block_push_latency_seconds_bucket
: Cumulative counterstron:block_push_latency_seconds_count
: Count of eventstron:block_push_latency_seconds_sum
: Total sum of all observed values
When handling the above block push logic, TRON's processing logic needs to acquire a synchronization lock. The lock_acquire_latency_seconds_x
metric is used to indicate the latency.
tron:lock_acquire_latency_seconds_bucket
: Cumulative counterstron:lock_acquire_latency_seconds_count
: Count of eventstron:lock_acquire_latency_seconds_sum
: Total sum of all observed values
Used to check the block latency received from peers and not from sync requests:
tron:block_fetch_latency_seconds_bucket
: Cumulative counterstron:block_fetch_latency_seconds_count
: Count of eventstron:block_fetch_latency_seconds_sum
: Total sum of all observed valuestron:block_receive_delay_seconds_bucket/count/sum
Verify the latency of all transactions' signatures when processing a block:
tron:verify_sign_latency_seconds_bucket
: Cumulative counters fortron:verify_sign_latency_seconds_count
: Count of eventstron:verify_sign_latency_seconds_sum
: Total sum of all observed values
Check the usage from dashboard panel (enter edit mode), or by searching in grafana_dashboard_tron_server.json.
tron:manager_queue_size
: The Manager Queue Size for pending/popped/queued/repush transaction types.tron:tx_cache
: TRON tx cache put action event.
Average transaction processing time:
tron:process_transaction_latency_seconds_bucket
: Cumulative counterstron:process_transaction_latency_seconds_count
: Count of eventtron:process_transaction_latency_seconds_sum
: Total sum of all observed values
TRON peers info and abnormal statistic metrics:
tron:peers
tron:p2p_disconnect_total
tron:p2p_error_total
The latency exceeds 50ms to process a message from a peer will be logged by the below metrics:
tron:message_process_latency_seconds_bucket
: Cumulative counters fortron:message_process_latency_seconds_count
: Count of eventstron:message_process_latency_seconds_sum
: Total sum of all observed values
Currently, the possible message types are: P2P_PING
, P2P_PONG
, P2P_HELLO
, P2P_DISCONNECT
, SYNC_BLOCK_CHAIN
, BLOCK_CHAIN_INVENTORY
, INVENTORY
, FETCH_INV_DATA
, BLOCK
, TRXS
, PBFT_COMMIT_MSG
.
Check node-connection for detail explanation of above types.
TCP/UDP network data traffic statistics:
tron:tcp_bytes_bucket
:Cumulative counterstron:tcp_bytes_count
:Count of eventstron:tcp_bytes_sum
:Total sum of all observed valuestron:udp_bytes_bucket/count/sum
Http request data traffic statistics:
tron:http_bytes_bucket
: Cumulative counterstron:http_bytes_count
:Count of eventstron:http_bytes_sum
: Total sum of all observed values
Http/GRPC request latency metrics:
tron:http_service_latency_seconds_bucket
: Cumulative counterstron:http_service_latency_seconds_count
: Count of eventstron:http_service_latency_seconds_sum
: Total sum of all observed valuestron:grpc_service_latency_seconds_bucket/count/sum
tron:internal_service_latency_seconds_bucket/count/sum
TRON blockchain storage chooses to use LevelDB, which is developed by Google and proven successful with many companies and projects. These below db related metrics all have filters with db
name and level
.
tron:db_size_bytes
tron:guava_cache_hit_rate
: Hit rate of a guava cache.tron:guava_cache_request
: Request of a guava cache.tron:guava_cache_eviction_count
: Eviction count of a guava cache.tron:db_sst_level
: Related with LevelDB SST file compaction.
Currently, for db
values of above metrics TRON has below possible objects:
- accountid-index
- abi
- account
- votes
- proposal
- witness
- code
- recent-transaction
- exchange-v2
- market_pair_to_price
- trans
- contract
- storage-row
- block
- exchange
- DelegatedResource
- tree-block-index
- balance-trace
- market_pair_price_to_order
- asset-issue
- transactionHistoryStore
- IncrementalMerkleTree
- delegation
- transactionRetStore
- account-index
- market_order
- witness_schedule
- nullifier
- DelegatedResourceAccountIndex
- properties
- common
- block-index
- accountTrie
- contract-state
- account-trace
- market_account
- recent-block
- asset-issue-v2
- section-bloom
- tmp
JVM basic info
jvm_info
: Basic JVM info with versionjvm_classes_currently_loaded
: The number of classes that are currently loaded in the JVMjvm_classes_loaded_total
jvm_classes_unloaded_total
JVM thread related
jvm_threads_current
jvm_threads_daemon
jvm_threads_peak
jvm_threads_started_total
jvm_threads_deadlocked
jvm_threads_deadlocked_monitor
jvm_threads_state
{state="RUNNABLE"/"TERMINATED"/"TIMED_WAITING"/"NEW"/"WAITING"/"BLOCKED"}
JVM garbage collection
jvm_gc_collection_seconds_count
: Count of JVM garbage collector eventjvm_gc_collection_seconds_sum
: Total sum of observed values
JVM memory related
jvm_buffer_pool_capacity_bytes
: Bytes capacity of a given JVM buffer pooljvm_buffer_pool_used_buffers
: Used buffers of a given JVM buffer pooljvm_buffer_pool_used_bytes
: Used bytes of a given JVM buffer pooljvm_memory_bytes_committed
: Committed (bytes) of a given JVM memory areajvm_memory_bytes_init
: Initial bytes of a given JVM memory areajvm_memory_bytes_max
: Max (bytes) of a given JVM memory areajvm_memory_bytes_used
: Used bytes of a given JVM memory areajvm_memory_objects_pending_finalization
: The number of objects waiting in the finalizer queuejvm_memory_pool_allocated_bytes_total
jvm_memory_pool_bytes_committed
: Committed bytes of a given JVM memory pooljvm_memory_pool_bytes_init
: Initial bytes of a given JVM memory pooljvm_memory_pool_bytes_max
: Max bytes of a given JVM memory pooljvm_memory_pool_bytes_used
: Used bytes of a given JVM memory pooljvm_memory_pool_collection_committed_bytes
: Committed after last collection bytes of a given JVM memory pooljvm_memory_pool_collection_init_bytes
: Initial after last collection bytes of a given JVM memory pooljvm_memory_pool_collection_max_bytes
: Max bytes after last collection of a given JVM memory pooljvm_memory_pool_collection_used_bytes
: Used bytes after last collection of a given JVM memory pool
Beside above metrics, there are also metrics to measure the duration of a scrape process, which is useful for monitoring and understanding the performance of your Prometheus server and the targets it scrapes.
scrape_duration_seconds
: It measures the time taken (in seconds) for Prometheus to scrape a target. This includes the entire process of making an HTTP request to the target, receiving the response, and processing the metrics.scrape_samples_post_metric_relabeling
scrape_samples_scraped
scrape_series_added