QuarkChain / pyquarkchain

Python implementation of QuarkChain
https://quarkchain.io
MIT License
224 stars 114 forks source link

Integrate prometheus with pyquarkchain #897

Closed pichaoqkc closed 4 years ago

pichaoqkc commented 4 years ago

Will use Prometheus to monitor and expose required data as a metric to be fetched by the Prometheus server.

ninjaahhh commented 4 years ago

899 should help you on how to count the total balance from a root block

pichaoqkc commented 4 years ago

Run with command:

 python cluster.py --p2p --enable_prometheus --enable_count_balance --prom_tokens QKC,BTC

Output on localhost:8000:

# HELP token_total_balance Total balance of specified tokens
# TYPE token_total_balance gauge
token_total_balance{root_block_height="20",shard="total",timestamp="0x5f07d1e7",token="QKC"} 4.8007000605e+28
token_total_balance{root_block_height="20",shard="0x00000003",timestamp="0x5f07d1e7",token="QKC"} 1.200300014e+28
token_total_balance{root_block_height="20",shard="0x00010003",timestamp="0x5f07d1e7",token="QKC"} 1.20000001375e+28
token_total_balance{root_block_height="20",shard="0x00020002",timestamp="0x5f07d1e7",token="QKC"} 1.20020001675e+28
token_total_balance{root_block_height="20",shard="0x00020003",timestamp="0x5f07d1e7",token="QKC"} 1.200200016e+28
token_total_balance{root_block_height="20",shard="total",timestamp="0x5f07d1e7",token="BTC"} 0.0
token_total_balance{root_block_height="20",shard="0x00000003",timestamp="0x5f07d1e7",token="BTC"} 0.0
token_total_balance{root_block_height="20",shard="0x00010003",timestamp="0x5f07d1e7",token="BTC"} 0.0
token_total_balance{root_block_height="20",shard="0x00020002",timestamp="0x5f07d1e7",token="BTC"} 0.0
token_total_balance{root_block_height="20",shard="0x00020003",timestamp="0x5f07d1e7",token="BTC"} 0.0

Prometheus console:

image

Prometheus graph:

image