This repository was archived by the owner on Nov 6, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Prometheus metrics #11823
Open
adria0
wants to merge
34
commits into
master
Choose a base branch
from
adria0/prometheus-tokio-compat
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Prometheus metrics #11823
Changes from 21 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
651da65
wip
f85bd40
working version
6e967d6
fix perf compilation
6665e8d
docker-compose
66d11ba
Add missing forks to fork ID (#11747)
vorot93 9132ab2
Implementation of EIP 2537 (#11707)
shamatar 4a26608
update secret-store reference (#11761)
svyatonik b76c116
Update Simple Subroutines to the latest spec (#11731)
adria0 588908e
Add YOLO-1 testnet
vorot93 47c535b
Upgrade num to 0.2, use enum-primitive-derive (#11636)
vorot93 40b885c
Better board & metrics
defa348
Fix tests
d747efb
Dev & Host docker-composes
d213ec0
Use hyper instead rpc
5140770
Update to master
3d9e9f0
Minor changes
b1c0527
Fix tests
53cc9ea
Metrics only for full client ci-build-docker
1fa9123
wip
6179214
Serve prometheus in tokio compat
137c86d
update to runtime 0.1.2
b523e39
Update ethcore/snapshot/src/service.rs
adria0 e69504e
Update ethcore/src/client/client.rs
adria0 631a1e9
Update ethcore/sync/src/api.rs
adria0 76bdfe3
Update ethcore/sync/src/api.rs
adria0 02595b0
Update util/stats/src/lib.rs
adria0 f75316c
Merge branch 'master' into adria0/prometheus-tokio-compat
adria0 4014fe1
Rename to taking_snapshot_at
19b7279
Fix metrics Results handling
14598b3
use parking_lot::Mutex
b9b6758
spawn_blocking metrics collection
6f8b668
Update util/stats/src/lib.rs
adria0 0a4bd5c
fix rust2018 use
16d89fc
Use Duration::as_millis()
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ name = "openethereum" | |
# NOTE Make sure to update util/version/Cargo.toml as well | ||
version = "3.0.0" | ||
license = "GPL-3.0" | ||
edition = "2018" | ||
authors = [ | ||
"OpenEthereum developers", | ||
"Parity Technologies <[email protected]>" | ||
|
@@ -40,6 +41,7 @@ ethkey = { path = "accounts/ethkey" } | |
ethstore = { path = "accounts/ethstore" } | ||
fdlimit = "0.1" | ||
futures = "0.1" | ||
hyper = { version = "0.13" } | ||
journaldb = { path = "util/journaldb" } | ||
jsonrpc-core = "14.0.3" | ||
keccak-hash = "0.5.0" | ||
|
@@ -58,7 +60,7 @@ parity-hash-fetch = { path = "updater/hash-fetch" } | |
parity-local-store = { path = "miner/local-store" } | ||
parity-path = "0.1" | ||
parity-rpc = { path = "rpc" } | ||
parity-runtime = "0.1.1" | ||
parity-runtime = "0.1.2" | ||
parity-secretstore = { git = "https://github.com/paritytech/secret-store", branch = "v1.x", optional = true } | ||
parity-updater = { path = "updater" } | ||
parity-util-mem = { version = "0.6.0", features = ["jemalloc-global"] } | ||
|
@@ -75,10 +77,12 @@ serde_derive = "1.0" | |
serde_json = "1.0" | ||
snapshot = { path = "ethcore/snapshot" } | ||
spec = { path = "ethcore/spec" } | ||
stats = { path = "util/stats" } | ||
term_size = "0.3" | ||
textwrap = "0.11.0" | ||
toml = "0.5.6" | ||
verification = { path = "ethcore/verification" } | ||
prometheus = "0.9.0" | ||
|
||
[build-dependencies] | ||
rustc_version = "0.2" | ||
|
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,6 +136,7 @@ use types::data_format::DataFormat; | |
use verification::{self, BlockQueue}; | ||
use verification::queue::kind::BlockLike; | ||
use vm::{CreateContractAddress, EnvInfo, LastHashes}; | ||
use stats::{prometheus_counter, prometheus_gauge, prometheus, PrometheusMetrics}; | ||
|
||
const MAX_ANCIENT_BLOCKS_QUEUE_SIZE: usize = 4096; | ||
// Max number of blocks imported at once. | ||
|
@@ -2857,6 +2858,66 @@ impl IoChannelQueue { | |
} | ||
} | ||
|
||
impl PrometheusMetrics for Client { | ||
fn prometheus_metrics(&self, r: &mut prometheus::Registry) { | ||
|
||
// gas, tx & blocks | ||
let report = self.report(); | ||
|
||
prometheus_counter(r, "import_gas", "Gas processed", report.gas_processed.as_u64() as i64); | ||
prometheus_counter(r, "import_blocks", "Blocks imported", report.blocks_imported as i64); | ||
prometheus_counter(r, "import_txs", "Transactions applied", report.transactions_applied as i64); | ||
|
||
let state_db = self.state_db.read(); | ||
prometheus_gauge(r, "statedb_mem_used", "State DB memory used", state_db.mem_used() as i64); | ||
prometheus_gauge(r, "statedb_cache_size", "State DB cache size", state_db.cache_size() as i64); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe drop the read-lock here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah consider putting this under a scope |
||
|
||
// blockchain caché | ||
adria0 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
let blockchain_cache_info = self.blockchain_cache_info(); | ||
prometheus_gauge(r, "blockchaincache_block_details", "BlockDetails cache size", blockchain_cache_info.block_details as i64); | ||
prometheus_gauge(r, "blockchaincache_block_recipts", "Block receipts size", blockchain_cache_info.block_receipts as i64); | ||
prometheus_gauge(r, "blockchaincache_blocks", "Blocks cache size", blockchain_cache_info.blocks as i64); | ||
prometheus_gauge(r, "blockchaincache_txaddrs", "Transaction addresses cache size", blockchain_cache_info.transaction_addresses as i64); | ||
prometheus_gauge(r, "blockchaincache_size", "Total blockchain cache size", blockchain_cache_info.total() as i64); | ||
|
||
// io | ||
let io_stats = self.db.read().key_value().io_stats(kvdb::IoStatsKind::Overall); | ||
prometheus_counter(r, "io_transactions", "Number of transactions", io_stats.transactions as i64); | ||
prometheus_counter(r, "io_reads", "Number of read operations", io_stats.reads as i64); | ||
prometheus_counter(r, "io_writes", "Number of write operations", io_stats.writes as i64); | ||
prometheus_counter(r, "io_cache_reads", "Number of reads resulted in a read from cache", io_stats.cache_reads as i64); | ||
prometheus_counter(r, "io_bytes_read", "Number of bytes read", io_stats.bytes_read as i64); | ||
prometheus_counter(r, "io_cache_read_bytes", "Number of cache bytes read", io_stats.cache_read_bytes as i64); | ||
prometheus_counter(r, "io_bytes_written", "Number of bytes written", io_stats.bytes_written as i64); | ||
|
||
// chain info | ||
let chain = self.chain_info(); | ||
|
||
let gap = chain.ancient_block_number.map(|x| U256::from(x + 1)) | ||
.and_then(|first| chain.first_block_number.map(|last| (first, U256::from(last)))); | ||
if let Some((first,last)) = gap { | ||
prometheus_gauge(r, "chain_warpsync_gap_first", "Warp sync gap, first block", first.as_u64() as i64); | ||
prometheus_gauge(r, "chain_warpsync_gap_last", "Warp sync gap, last block", last.as_u64() as i64); | ||
} | ||
|
||
prometheus_gauge(r, "chain_block", "Best block number", chain.best_block_number as i64); | ||
|
||
// prunning info | ||
let prunning = self.pruning_info(); | ||
prometheus_gauge(r, "prunning_earliest_chain", "The first block which everything can be served after", prunning.earliest_chain as i64); | ||
prometheus_gauge(r, "prunning_earliest_state", "The first block where state requests may be served", prunning.earliest_state as i64); | ||
|
||
// queue info | ||
let queue = self.queue_info(); | ||
prometheus_gauge(r, "queue_mem_used", "Queue heap memory used in bytes", queue.mem_used as i64); | ||
prometheus_gauge(r, "queue_size_total", "The total size of the queues", queue.total_queue_size() as i64); | ||
prometheus_gauge(r, "queue_size_unverified", "Number of queued items pending verification", queue.unverified_queue_size as i64); | ||
prometheus_gauge(r, "queue_size_verified", "Number of verified queued items pending import", queue.verified_queue_size as i64); | ||
prometheus_gauge(r, "queue_size_verifying", "Number of items being verified", queue.verifying_queue_size as i64); | ||
|
||
} | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use std::sync::Arc; | ||
|
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.