diff --git a/Cargo.lock b/Cargo.lock index 6ab5f96a034..93d054508d7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -129,6 +129,12 @@ dependencies = [ "xdg", ] +[[package]] +name = "arc-swap" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d25d88fd6b8041580a654f9d0c581a047baee2b3efee13275f2fc392fc75034" + [[package]] name = "arrayref" version = "0.3.6" @@ -153,7 +159,7 @@ version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd4da2f0d9a8eb4e0aabc162278968eaf753999aa4aed173b753f9fa8da4cb86" dependencies = [ - "http", + "http 0.1.21", "log", "url 1.7.2", ] @@ -502,6 +508,15 @@ dependencies = [ "iovec", ] +[[package]] +name = "bytes" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "118cf036fbb97d0816e3c34b2d7a1e8cfc60f68fcf63d550ddbe9bd5f59c213b" +dependencies = [ + "loom", +] + [[package]] name = "cast" version = "0.2.3" @@ -585,7 +600,7 @@ name = "cli-signer" version = "1.4.0" dependencies = [ "ethereum-types", - "futures", + "futures 0.1.29", "parity-rpc", "parity-rpc-client", "rpassword", @@ -1184,7 +1199,7 @@ dependencies = [ "evm", "executive-state", "fetch", - "futures", + "futures 0.1.29", "hash-db", "itertools", "journaldb", @@ -1322,7 +1337,7 @@ version = "1.12.0" dependencies = [ "crossbeam-deque", "fnv", - "futures", + "futures 0.1.29", "log", "mio", "num_cpus", @@ -1330,7 +1345,7 @@ dependencies = [ "slab", "time", "timer", - "tokio", + "tokio 0.1.22", ] [[package]] @@ -1352,7 +1367,7 @@ dependencies = [ "executive-state", "failsafe", "fastmap", - "futures", + "futures 0.1.29", "hash-db", "journaldb", "keccak-hash", @@ -1411,8 +1426,8 @@ dependencies = [ "ethcore-call-contract", "ethereum-types", "fetch", - "futures", - "hyper", + "futures 0.1.29", + "hyper 0.12.35", "keccak-hash", "linked-hash-map", "log", @@ -1457,7 +1472,7 @@ version = "1.12.0" dependencies = [ "ansi_term", "assert_matches", - "bytes", + "bytes 0.4.12", "derive_more", "enr", "env_logger 0.5.13", @@ -1508,7 +1523,7 @@ dependencies = [ "ethereum-types", "ethjson", "fetch", - "futures", + "futures 0.1.29", "hash-db", "journaldb", "keccak-hash", @@ -1573,7 +1588,7 @@ dependencies = [ "keccak-hash", "log", "parking_lot 0.10.0", - "tokio", + "tokio 0.1.22", "tokio-io", ] @@ -1596,7 +1611,7 @@ dependencies = [ "ethereum-forkid", "ethereum-types", "fastmap", - "futures", + "futures 0.1.29", "indexmap", "keccak-hash", "kvdb-memorydb", @@ -1614,6 +1629,7 @@ dependencies = [ "rustc-hex 2.1.0", "snapshot", "spec", + "stats", "trace-time", "triehash-ethereum", ] @@ -1812,7 +1828,7 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf04c6ffd217a68c73fdf40eb3331c484fd7a9fa4fd1028fcf74456ef889ca12" dependencies = [ - "futures", + "futures 0.1.29", "parking_lot 0.6.4", "rand 0.5.6", ] @@ -1844,8 +1860,8 @@ name = "fake-fetch" version = "0.0.1" dependencies = [ "fetch", - "futures", - "hyper", + "futures 0.1.29", + "hyper 0.12.35", ] [[package]] @@ -1875,13 +1891,13 @@ dependencies = [ name = "fetch" version = "0.1.0" dependencies = [ - "bytes", - "futures", - "http", - "hyper", + "bytes 0.4.12", + "futures 0.1.29", + "http 0.1.21", + "hyper 0.12.35", "hyper-rustls", "log", - "tokio", + "tokio 0.1.22", "url 2.1.1", ] @@ -1971,16 +1987,85 @@ version = "0.1.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef" +[[package]] +name = "futures" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e05b85ec287aac0dc34db7d4a569323df697f9c55b99b15d6b4ef8cde49f613" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f366ad74c28cca6ba456d95e6422883cfb4b252a83bed929c83abfdbbf2967d5" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59f5fff90fd5d971f936ad674802482ba441b6f09ba5e15fd8b39145582ca399" + [[package]] name = "futures-cpupool" version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab90cde24b3319636588d0c35fe03b1333857621051837ed769faefb4c2162e4" dependencies = [ - "futures", + "futures 0.1.29", "num_cpus", ] +[[package]] +name = "futures-io" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de27142b013a8e869c14957e6d2edeef89e97c289e69d042ee3a49acd8b51789" + +[[package]] +name = "futures-sink" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f2032893cb734c7a05d85ce0cc8b8c4075278e93b24b66f9de99d6eb0fa8acc" + +[[package]] +name = "futures-task" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdb66b5f09e22019b1ab0830f7785bcea8e7a42148683f99214f73f8ec21a626" +dependencies = [ + "once_cell", +] + +[[package]] +name = "futures-util" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8764574ff08b701a084482c3c7031349104b07ac897393010494beaa18ce32c6" +dependencies = [ + "futures 0.1.29", + "futures-channel", + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "memchr", + "pin-project", + "pin-utils", + "slab", +] + [[package]] name = "fxhash" version = "0.2.1" @@ -1990,6 +2075,19 @@ dependencies = [ "byteorder", ] +[[package]] +name = "generator" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "add72f17bb81521258fcc8a7a3245b1e184e916bfbe34f0ea89558f440df5c68" +dependencies = [ + "cc", + "libc", + "log", + "rustc_version", + "winapi 0.3.8", +] + [[package]] name = "generic-array" version = "0.12.3" @@ -2036,10 +2134,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a5b34c246847f938a410a03c5458c7fee2274436675e76d8b903c08efc29c462" dependencies = [ "byteorder", - "bytes", + "bytes 0.4.12", "fnv", - "futures", - "http", + "futures 0.1.29", + "http 0.1.21", "indexmap", "log", "slab", @@ -2047,6 +2145,25 @@ dependencies = [ "tokio-io", ] +[[package]] +name = "h2" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79b7246d7e4b979c03fa093da39cfb3617a96bbeee6310af63991668d7e843ff" +dependencies = [ + "bytes 0.5.5", + "fnv", + "futures-core", + "futures-sink", + "futures-util", + "http 0.2.1", + "indexmap", + "log", + "slab", + "tokio 0.2.21", + "tokio-util", +] + [[package]] name = "hamming" version = "0.1.3" @@ -2165,7 +2282,18 @@ version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d6ccf5ede3a895d8856620237b2f02972c1bbc78d2965ad7fe8838d4a0ed41f0" dependencies = [ - "bytes", + "bytes 0.4.12", + "fnv", + "itoa", +] + +[[package]] +name = "http" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d569972648b2c512421b5f2a405ad6ac9666547189d0c5477a3f200f3e02f9" +dependencies = [ + "bytes 0.5.5", "fnv", "itoa", ] @@ -2176,12 +2304,22 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6741c859c1b2463a423a1dbce98d418e6c3c3fc720fb0d45528657320920292d" dependencies = [ - "bytes", - "futures", - "http", + "bytes 0.4.12", + "futures 0.1.29", + "http 0.1.21", "tokio-buf", ] +[[package]] +name = "http-body" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b" +dependencies = [ + "bytes 0.5.5", + "http 0.2.1", +] + [[package]] name = "httparse" version = "1.3.4" @@ -2203,12 +2341,12 @@ version = "0.12.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9dbe6ed1438e1f8ad955a4701e9a944938e9519f6888d12d8558b645e247d5f6" dependencies = [ - "bytes", - "futures", + "bytes 0.4.12", + "futures 0.1.29", "futures-cpupool", - "h2", - "http", - "http-body", + "h2 0.1.26", + "http 0.1.21", + "http-body 0.1.0", "httparse", "iovec", "itoa", @@ -2216,7 +2354,7 @@ dependencies = [ "net2", "rustc_version", "time", - "tokio", + "tokio 0.1.22", "tokio-buf", "tokio-executor", "tokio-io", @@ -2224,7 +2362,31 @@ dependencies = [ "tokio-tcp", "tokio-threadpool", "tokio-timer", - "want", + "want 0.2.0", +] + +[[package]] +name = "hyper" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6e7655b9594024ad0ee439f3b5a7299369dc2a3f459b47c696f9ff676f9aa1f" +dependencies = [ + "bytes 0.5.5", + "futures-channel", + "futures-core", + "futures-util", + "h2 0.2.5", + "http 0.2.1", + "http-body 0.3.1", + "httparse", + "itoa", + "log", + "pin-project", + "socket2", + "time", + "tokio 0.2.21", + "tower-service", + "want 0.3.0", ] [[package]] @@ -2233,10 +2395,10 @@ version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b66a4973381d01141ed0a4f20070d47a232c764642dd6217d3d93f7a1f952ea5" dependencies = [ - "bytes", + "bytes 0.4.12", "ct-logs", - "futures", - "hyper", + "futures 0.1.29", + "hyper 0.12.35", "rustls", "rustls-native-certs", "tokio-io", @@ -2434,7 +2596,7 @@ version = "14.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fe3b688648f1ef5d5072229e2d672ecb92cbff7d1c79bcf3fd5898f3f3df0970" dependencies = [ - "futures", + "futures 0.1.29", "log", "serde", "serde_derive", @@ -2459,7 +2621,7 @@ version = "14.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "816d63997ea45d3634608edbef83ddb35e661f7c0b27b5b72f237e321f0e9807" dependencies = [ - "hyper", + "hyper 0.12.35", "jsonrpc-core", "jsonrpc-server-utils", "log", @@ -2500,12 +2662,12 @@ version = "14.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95b7635e618a0edbbe0d2a2bbbc69874277c49383fcf6c3c0414491cfb517d22" dependencies = [ - "bytes", + "bytes 0.4.12", "globset", "jsonrpc-core", "lazy_static", "log", - "tokio", + "tokio 0.1.22", "tokio-codec", "unicase", ] @@ -2737,6 +2899,17 @@ dependencies = [ "utf8-ranges", ] +[[package]] +name = "loom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ecc775857611e1df29abba5c41355cdf540e7e9d4acfdf0f355eefee82330b7" +dependencies = [ + "cfg-if", + "generator", + "scoped-tls", +] + [[package]] name = "lru" version = "0.5.2" @@ -3212,7 +3385,8 @@ dependencies = [ "ethstore", "fake-fetch", "fdlimit", - "futures", + "futures 0.1.29", + "hyper 0.13.6", "ipnetwork", "journaldb", "jsonrpc-core", @@ -3239,6 +3413,7 @@ dependencies = [ "parity-version", "parking_lot 0.10.0", "pretty_assertions", + "prometheus", "regex", "registrar", "rlp", @@ -3251,9 +3426,11 @@ dependencies = [ "serde_json", "snapshot", "spec", + "stats", "tempfile", "term_size", "textwrap", + "tokio 0.2.21", "toml", "verification", "winapi 0.3.8", @@ -3349,7 +3526,7 @@ dependencies = [ "ethereum-types", "fake-fetch", "fetch", - "futures", + "futures 0.1.29", "keccak-hash", "log", "mime", @@ -3415,7 +3592,7 @@ dependencies = [ "fake-fetch", "fastmap", "fetch", - "futures", + "futures 0.1.29", "itertools", "jsonrpc-core", "jsonrpc-derive", @@ -3461,7 +3638,7 @@ name = "parity-rpc-client" version = "1.4.0" dependencies = [ "ethereum-types", - "futures", + "futures 0.1.29", "jsonrpc-core", "jsonrpc-ws-server", "keccak-hash", @@ -3476,12 +3653,14 @@ dependencies = [ [[package]] name = "parity-runtime" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "710e8d8e9769827952aa83a44d33bc993658cccd97e15e3b5eb070d1a70d1a3a" +checksum = "486214cb6d1fc274248f735a3edfd7eea94fd928db1e0c4118b7c9ecde06fd4b" dependencies = [ - "futures", - "tokio", + "futures 0.1.29", + "futures 0.3.5", + "tokio 0.2.21", + "tokio-compat", ] [[package]] @@ -3506,8 +3685,8 @@ dependencies = [ "ethabi-contract", "ethabi-derive", "ethereum-types", - "futures", - "hyper", + "futures 0.1.29", + "hyper 0.12.35", "jsonrpc-server-utils", "keccak-hash", "kvdb", @@ -3525,7 +3704,7 @@ dependencies = [ "serde_derive", "serde_json", "tiny-keccak 1.5.0", - "tokio", + "tokio 0.1.22", "tokio-io", "tokio-service", "url 2.1.1", @@ -3537,14 +3716,14 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e57fea504fea33f9fbb5f49f378359030e7e026a6ab849bb9e8f0787376f1bf" dependencies = [ - "bytes", - "futures", + "bytes 0.4.12", + "futures 0.1.29", "libc", "log", "mio-named-pipes", "miow 0.3.3", "rand 0.7.3", - "tokio", + "tokio 0.1.22", "tokio-named-pipes", "tokio-uds", "winapi 0.3.8", @@ -3774,6 +3953,38 @@ dependencies = [ "ordermap", ] +[[package]] +name = "pin-project" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12e3a6cdbfe94a5e4572812a0201f8c0ed98c1c452c7b8563ce2276988ef9c17" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a0ffd45cf79d88737d7cc85bfd5d2894bee1139b356e616fe85dc389c61aaf7" +dependencies = [ + "proc-macro2 1.0.9", + "quote 1.0.3", + "syn 1.0.17", +] + +[[package]] +name = "pin-project-lite" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282adbf10f2698a7a77f8e983a74b2d18176c19a7fd32a45446139ae7b02b715" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + [[package]] name = "plain_hasher" version = "0.2.3" @@ -3839,7 +4050,7 @@ version = "1.12.0" dependencies = [ "fake-fetch", "fetch", - "futures", + "futures 0.1.29", "log", "parity-runtime", "serde_json", @@ -3938,6 +4149,26 @@ dependencies = [ "unicode-xid 0.2.0", ] +[[package]] +name = "prometheus" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd0ced56dee39a6e960c15c74dc48849d614586db2eaada6497477af7c7811cd" +dependencies = [ + "cfg-if", + "fnv", + "lazy_static", + "protobuf", + "spin", + "thiserror", +] + +[[package]] +name = "protobuf" +version = "2.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e86d370532557ae7573551a1ec8235a0f8d6cb276c7c9e6aa490b511c447485" + [[package]] name = "pwasm-run-test" version = "0.1.0" @@ -4430,6 +4661,12 @@ dependencies = [ "winapi 0.3.8", ] +[[package]] +name = "scoped-tls" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "332ffa32bf586782a3efaeb58f127980944bbc8c4d6913a86107ac2a5ab24b28" + [[package]] name = "scopeguard" version = "0.3.3" @@ -4592,6 +4829,16 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" +[[package]] +name = "signal-hook-registry" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94f478ede9f64724c5d173d7bb56099ec3e2d9fc2774aac65d34b8b890405f41" +dependencies = [ + "arc-swap", + "libc", +] + [[package]] name = "simple_uint" version = "0.1.0" @@ -4814,6 +5061,7 @@ name = "stats" version = "0.1.0" dependencies = [ "log", + "prometheus", ] [[package]] @@ -4831,7 +5079,7 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d24114bfcceb867ca7f71a0d3fe45d45619ec47a6fbfa98cb14e14250bfa5d6d" dependencies = [ - "bytes", + "bytes 0.4.12", ] [[package]] @@ -4941,6 +5189,26 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "thiserror" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b13f926965ad00595dd129fa12823b04bbf866e9085ab0a5f2b05b850fbfc344" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "893582086c2f98cde18f906265a65b5030a074b1046c674ae898be6519a7f479" +dependencies = [ + "proc-macro2 1.0.9", + "quote 1.0.3", + "syn 1.0.17", +] + [[package]] name = "thread-id" version = "3.3.0" @@ -5028,8 +5296,8 @@ version = "0.1.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a09c0b5bb588872ab2f09afa13ee6e9dac11e10a0ec9e8e3ba39a5a5d530af6" dependencies = [ - "bytes", - "futures", + "bytes 0.4.12", + "futures 0.1.29", "mio", "num_cpus", "tokio-codec", @@ -5046,15 +5314,39 @@ dependencies = [ "tokio-uds", ] +[[package]] +name = "tokio" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d099fa27b9702bed751524694adbe393e18b36b204da91eb1cbbbbb4a5ee2d58" +dependencies = [ + "bytes 0.5.5", + "fnv", + "futures-core", + "iovec", + "lazy_static", + "libc", + "memchr", + "mio", + "mio-named-pipes", + "mio-uds", + "num_cpus", + "pin-project-lite", + "signal-hook-registry", + "slab", + "tokio-macros", + "winapi 0.3.8", +] + [[package]] name = "tokio-buf" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fb220f46c53859a4b7ec083e41dec9778ff0b1851c0942b211edb89e0ccdc46" dependencies = [ - "bytes", + "bytes 0.4.12", "either", - "futures", + "futures 0.1.29", ] [[package]] @@ -5063,18 +5355,35 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25b2998660ba0e70d18684de5d06b70b70a3a747469af9dea7618cc59e75976b" dependencies = [ - "bytes", - "futures", + "bytes 0.4.12", + "futures 0.1.29", "tokio-io", ] +[[package]] +name = "tokio-compat" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "107b625135aa7b9297dd2d99ccd6ca6ab124a5d1230778e159b9095adca4c722" +dependencies = [ + "futures 0.1.29", + "futures-core", + "futures-util", + "pin-project-lite", + "tokio 0.2.21", + "tokio-current-thread", + "tokio-executor", + "tokio-reactor", + "tokio-timer", +] + [[package]] name = "tokio-current-thread" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b1de0e32a83f131e002238d7ccde18211c0a5397f60cbfffcb112868c2e0e20e" dependencies = [ - "futures", + "futures 0.1.29", "tokio-executor", ] @@ -5085,7 +5394,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb2d1b8f4548dbf5e1f7818512e9c406860678f29c300cdf0ebac72d1a3a1671" dependencies = [ "crossbeam-utils", - "futures", + "futures 0.1.29", ] [[package]] @@ -5094,7 +5403,7 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "297a1206e0ca6302a0eed35b700d292b275256f596e2f3fea7729d5e629b6ff4" dependencies = [ - "futures", + "futures 0.1.29", "tokio-io", "tokio-threadpool", ] @@ -5105,22 +5414,33 @@ version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57fc868aae093479e3131e3d165c93b1c7474109d13c90ec0dda2a1bbfff0674" dependencies = [ - "bytes", - "futures", + "bytes 0.4.12", + "futures 0.1.29", "log", ] +[[package]] +name = "tokio-macros" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0c3acc6aa564495a0f2e1d59fab677cd7f81a19994cfc7f3ad0e64301560389" +dependencies = [ + "proc-macro2 1.0.9", + "quote 1.0.3", + "syn 1.0.17", +] + [[package]] name = "tokio-named-pipes" version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d282d483052288b2308ba5ee795f5673b159c9bdf63c385a05609da782a5eae" dependencies = [ - "bytes", - "futures", + "bytes 0.4.12", + "futures 0.1.29", "mio", "mio-named-pipes", - "tokio", + "tokio 0.1.22", ] [[package]] @@ -5130,7 +5450,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09bc590ec4ba8ba87652da2068d150dcada2cfa2e07faae270a5e0409aa51351" dependencies = [ "crossbeam-utils", - "futures", + "futures 0.1.29", "lazy_static", "log", "mio", @@ -5148,8 +5468,8 @@ version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d7cf08f990090abd6c6a73cab46fed62f85e8aef8b99e4b918a9f4a637f0676" dependencies = [ - "bytes", - "futures", + "bytes 0.4.12", + "futures 0.1.29", "iovec", "rustls", "tokio-io", @@ -5162,7 +5482,7 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24da22d077e0f15f55162bdbdc661228c1581892f52074fb242678d015b45162" dependencies = [ - "futures", + "futures 0.1.29", ] [[package]] @@ -5172,7 +5492,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "edfe50152bc8164fcc456dab7891fa9bf8beaf01c5ee7e1dd43a397c3cf87dee" dependencies = [ "fnv", - "futures", + "futures 0.1.29", ] [[package]] @@ -5181,8 +5501,8 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "98df18ed66e3b72e742f185882a9e201892407957e45fbff8da17ae7a7c51f72" dependencies = [ - "bytes", - "futures", + "bytes 0.4.12", + "futures 0.1.29", "iovec", "mio", "tokio-io", @@ -5198,7 +5518,7 @@ dependencies = [ "crossbeam-deque", "crossbeam-queue", "crossbeam-utils", - "futures", + "futures 0.1.29", "lazy_static", "log", "num_cpus", @@ -5213,7 +5533,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "93044f2d313c95ff1cb7809ce9a7a05735b012288a888b62d4434fd58c94f296" dependencies = [ "crossbeam-utils", - "futures", + "futures 0.1.29", "slab", "tokio-executor", ] @@ -5224,8 +5544,8 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2a0b10e610b39c38b031a2fcab08e4b82f16ece36504988dcbd81dbba650d82" dependencies = [ - "bytes", - "futures", + "bytes 0.4.12", + "futures 0.1.29", "log", "mio", "tokio-codec", @@ -5239,8 +5559,8 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5076db410d6fdc6523df7595447629099a1fdc47b3d9f896220780fa48faf798" dependencies = [ - "bytes", - "futures", + "bytes 0.4.12", + "futures 0.1.29", "iovec", "libc", "log", @@ -5251,6 +5571,20 @@ dependencies = [ "tokio-reactor", ] +[[package]] +name = "tokio-util" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499" +dependencies = [ + "bytes 0.5.5", + "futures-core", + "futures-sink", + "log", + "pin-project-lite", + "tokio 0.2.21", +] + [[package]] name = "toml" version = "0.5.6" @@ -5269,6 +5603,12 @@ dependencies = [ "fxhash", ] +[[package]] +name = "tower-service" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860" + [[package]] name = "trace" version = "0.1.0" @@ -5640,7 +5980,17 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6395efa4784b027708f7451087e647ec73cc74f5d9bc2e418404248d679a230" dependencies = [ - "futures", + "futures 0.1.29", + "log", + "try-lock", +] + +[[package]] +name = "want" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +dependencies = [ "log", "try-lock", ] @@ -5811,7 +6161,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c51a2c47b5798ccc774ffb93ff536aec7c4275d722fd9c740c83cdd1af1f2d94" dependencies = [ "byteorder", - "bytes", + "bytes 0.4.12", "httparse", "log", "mio", diff --git a/Cargo.toml b/Cargo.toml index 8ed2e744079..74bf91b4d5d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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 " @@ -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.7", features = ["jemalloc-global"] } @@ -75,10 +77,13 @@ 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" +tokio = { version = "0.2", features = ["blocking"] } verification = { path = "ethcore/verification" } +prometheus = "0.9.0" [build-dependencies] rustc_version = "0.2" diff --git a/ethcore/Cargo.toml b/ethcore/Cargo.toml index 4d6335d0003..eb67d7586df 100644 --- a/ethcore/Cargo.toml +++ b/ethcore/Cargo.toml @@ -56,6 +56,7 @@ serde_derive = "1.0" snapshot = { path = "snapshot" } spec = { path = "spec" } state-db = { path = "state-db" } +stats = { path = "../util/stats" } tempfile = { version = "3.1", optional = true } trace = { path = "trace" } trace-time = "0.1" @@ -81,9 +82,8 @@ kvdb-memorydb = "0.7" kvdb-rocksdb = "0.9" lazy_static = "1.3" machine = { path = "./machine", features = ["test-helpers"] } -parity-runtime = "0.1.1" +parity-runtime = "0.1.2" serde_json = "1.0" -stats = { path = "../util/stats" } pod = { path = "pod" } tempfile = "3.1" trie-standardmap = "0.15.0" diff --git a/ethcore/service/src/service.rs b/ethcore/service/src/service.rs index 0be68fdba46..d7349cb7ac8 100644 --- a/ethcore/service/src/service.rs +++ b/ethcore/service/src/service.rs @@ -240,7 +240,7 @@ where match timer { CLIENT_TICK_TIMER => { use snapshot::SnapshotService; - let snapshot_restoration = if let RestorationStatus::Ongoing{..} = self.snapshot.status() { true } else { false }; + let snapshot_restoration = if let RestorationStatus::Ongoing{..} = self.snapshot.restoration_status() { true } else { false }; self.client.tick(snapshot_restoration) }, SNAPSHOT_TICK_TIMER => self.snapshot.tick(), diff --git a/ethcore/snapshot/snapshot-tests/src/service.rs b/ethcore/snapshot/snapshot-tests/src/service.rs index ba8878ba5b0..d7d2a1dfc9e 100644 --- a/ethcore/snapshot/snapshot-tests/src/service.rs +++ b/ethcore/snapshot/snapshot-tests/src/service.rs @@ -71,7 +71,7 @@ fn sends_async_messages() { assert!(service.manifest().is_none()); assert!(service.chunk(Default::default()).is_none()); - assert_eq!(service.status(), RestorationStatus::Inactive); + assert_eq!(service.restoration_status(), RestorationStatus::Inactive); let manifest = ManifestData { version: 2, @@ -190,7 +190,7 @@ fn restored_is_equivalent() { service.feed_block_chunk(hash, &chunk); } - assert_eq!(service.status(), RestorationStatus::Inactive); + assert_eq!(service.restoration_status(), RestorationStatus::Inactive); for x in 0..NUM_BLOCKS { let block1 = client.block(BlockId::Number(x as u64)).unwrap(); @@ -347,7 +347,7 @@ fn keep_ancient_blocks() { service.feed_state_chunk(*hash, &chunk); } - match service.status() { + match service.restoration_status() { RestorationStatus::Inactive => (), RestorationStatus::Failed => panic!("Snapshot Restoration has failed."), RestorationStatus::Ongoing { .. } => panic!("Snapshot Restoration should be done."), @@ -409,7 +409,7 @@ fn recover_aborted_recovery() { service.feed_state_chunk(*hash, &chunk); } - match service.status() { + match service.restoration_status() { RestorationStatus::Ongoing { block_chunks_done, state_chunks_done, .. } => { assert_eq!(state_chunks_done, manifest.state_hashes.len() as u32); assert_eq!(block_chunks_done, 0); @@ -423,7 +423,7 @@ fn recover_aborted_recovery() { // And try again! service.init_restore(manifest.clone(), true).unwrap(); - match service.status() { + match service.restoration_status() { RestorationStatus::Ongoing { block_chunks_done, state_chunks_done, .. } => { assert_eq!(state_chunks_done, manifest.state_hashes.len() as u32); assert_eq!(block_chunks_done, 0); @@ -438,7 +438,7 @@ fn recover_aborted_recovery() { // And try again! service.init_restore(manifest.clone(), true).unwrap(); - match service.status() { + match service.restoration_status() { RestorationStatus::Ongoing { block_chunks_done, state_chunks_done, .. } => { assert_eq!(block_chunks_done, 0); assert_eq!(state_chunks_done, 0); diff --git a/ethcore/snapshot/src/service.rs b/ethcore/snapshot/src/service.rs index f913afc9d5a..dd759886c42 100644 --- a/ethcore/snapshot/src/service.rs +++ b/ethcore/snapshot/src/service.rs @@ -30,7 +30,7 @@ use common_types::{ io_message::ClientIoMessage, errors::{EthcoreError as Error, SnapshotError, SnapshotError::UnlinkedAncientBlockChain}, ids::BlockId, - snapshot::{ManifestData, Progress, RestorationStatus}, + snapshot::{ManifestData, Progress, CreationStatus, RestorationStatus}, }; use client_traits::ChainInfo; use engine::Engine; @@ -265,6 +265,7 @@ pub struct Service { client: Arc, progress: RwLock, taking_snapshot: AtomicBool, + taking_snapshot_at: AtomicUsize, restoring_snapshot: AtomicBool, } @@ -286,6 +287,7 @@ impl Service where C: SnapshotClient + ChainInfo { client: params.client, progress: RwLock::new(Progress::new()), taking_snapshot: AtomicBool::new(false), + taking_snapshot_at: AtomicUsize::new(0), restoring_snapshot: AtomicBool::new(false), }; @@ -505,6 +507,7 @@ impl Service where C: SnapshotClient + ChainInfo { info!("Taking snapshot at #{}", num); { + self.taking_snapshot_at.store(num as usize, Ordering::SeqCst); scopeguard::defer! {{ self.taking_snapshot.store(false, Ordering::SeqCst); }} @@ -609,6 +612,7 @@ impl Service where C: SnapshotClient + ChainInfo { self.restoring_snapshot.store(true, Ordering::SeqCst); + let block_number = manifest.block_number; // Import previous chunks, continue if it fails self.import_prev_chunks(&mut res, manifest).ok(); @@ -616,6 +620,7 @@ impl Service where C: SnapshotClient + ChainInfo { let mut restoration_status = self.status.lock(); if let RestorationStatus::Initializing { .. } = *restoration_status { *restoration_status = RestorationStatus::Ongoing { + block_number, state_chunks: state_chunks as u32, block_chunks: block_chunks as u32, state_chunks_done: self.state_chunks.load(Ordering::SeqCst) as u32, @@ -760,7 +765,7 @@ impl Service where C: SnapshotClient + ChainInfo { chunk: &[u8], is_state: bool ) -> Result<(), Error> { - match self.status() { + match self.restoration_status() { RestorationStatus::Inactive | RestorationStatus::Failed | RestorationStatus::Finalizing => { trace!(target: "snapshot", "Tried to restore chunk {:x} while inactive, failed or finalizing", hash); Ok(()) @@ -832,7 +837,17 @@ impl SnapshotService for Service { self.reader.read().as_ref().and_then(|r| r.chunk(hash).ok()) } - fn status(&self) -> RestorationStatus { + fn creation_status(&self) -> CreationStatus { + if self.taking_snapshot.load(Ordering::SeqCst) { + CreationStatus::Ongoing { + block_number: self.taking_snapshot_at.load(Ordering::SeqCst) as u32 + } + } else { + CreationStatus::Inactive + } + } + + fn restoration_status(&self) -> RestorationStatus { let mut cur_status = self.status.lock(); match *cur_status { diff --git a/ethcore/snapshot/src/traits.rs b/ethcore/snapshot/src/traits.rs index 2528c0c883c..fd147ff1eaa 100644 --- a/ethcore/snapshot/src/traits.rs +++ b/ethcore/snapshot/src/traits.rs @@ -22,7 +22,7 @@ use client_traits::{BlockChainClient, BlockInfo, DatabaseRestore, BlockChainRese use common_types::{ ids::BlockId, errors::{EthcoreError as Error, SnapshotError}, - snapshot::{ManifestData, ChunkSink, Progress, RestorationStatus}, + snapshot::{ManifestData, ChunkSink, Progress, CreationStatus, RestorationStatus}, }; use engine::Engine; use ethereum_types::H256; @@ -49,7 +49,10 @@ pub trait SnapshotService : Sync + Send { fn chunk(&self, hash: H256) -> Option; /// Ask the snapshot service for the restoration status. - fn status(&self) -> RestorationStatus; + fn restoration_status(&self) -> RestorationStatus; + + /// Ask the snapshot service for the creation status. + fn creation_status(&self) -> CreationStatus; /// Begin snapshot restoration. /// If a restoration is in progress, this will reset it and clear all data. diff --git a/ethcore/src/client/client.rs b/ethcore/src/client/client.rs index 81340b1790c..b8668634a6a 100644 --- a/ethcore/src/client/client.rs +++ b/ethcore/src/client/client.rs @@ -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. @@ -2855,6 +2856,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); + + // blockchain cache + 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; diff --git a/ethcore/src/lib.rs b/ethcore/src/lib.rs index b21cd959b5f..8b81c1e6ecf 100644 --- a/ethcore/src/lib.rs +++ b/ethcore/src/lib.rs @@ -49,6 +49,7 @@ extern crate rlp; extern crate rustc_hex; extern crate serde; extern crate snapshot; +extern crate stats; extern crate spec; extern crate state_db; extern crate trace; diff --git a/ethcore/src/test_helpers/test_client.rs b/ethcore/src/test_helpers/test_client.rs index c0808f8dcc7..27edb4c1681 100644 --- a/ethcore/src/test_helpers/test_client.rs +++ b/ethcore/src/test_helpers/test_client.rs @@ -81,6 +81,7 @@ use spec::{Spec, self}; use account_state::state::StateInfo; use state_db::StateDB; use trace::LocalizedTrace; +use stats::{PrometheusMetrics, prometheus}; /// Test client. pub struct TestBlockChainClient { @@ -997,3 +998,8 @@ impl client_traits::EngineClient for TestBlockChainClient { BlockChainClient::block_header(self, id) } } + +impl PrometheusMetrics for TestBlockChainClient { + fn prometheus_metrics(&self, _r: &mut prometheus::Registry) { + } +} diff --git a/ethcore/sync/Cargo.toml b/ethcore/sync/Cargo.toml index fde5603b8c2..5eb70c05e0f 100644 --- a/ethcore/sync/Cargo.toml +++ b/ethcore/sync/Cargo.toml @@ -27,13 +27,14 @@ light = { package = "ethcore-light", path = "../light" } log = "0.4" network = { package = "ethcore-network", path = "../../util/network" } num-traits = "0.2" -parity-runtime = "0.1.1" +parity-runtime = "0.1.2" parity-crypto = { version = "0.6.2", features = ["publickey"] } parity-util-mem = "0.7" rand = "0.7.3" parking_lot = "0.10.0" rlp = "0.4.5" snapshot = { path = "../snapshot" } +stats = { path = "../../util/stats" } trace-time = "0.1" triehash-ethereum = { version = "0.2", path = "../../util/triehash-ethereum" } diff --git a/ethcore/sync/src/api.rs b/ethcore/sync/src/api.rs index 7cfdc330f7a..be4f3721044 100644 --- a/ethcore/sync/src/api.rs +++ b/ethcore/sync/src/api.rs @@ -65,8 +65,9 @@ use common_types::{ chain_notify::{NewBlocks, ChainMessageType}, pruning_info::PruningInfo, transaction::UnverifiedTransaction, + snapshot::{CreationStatus, RestorationStatus} }; - +use stats::{PrometheusMetrics, prometheus_counter, prometheus_gauge, prometheus}; /// Parity sync protocol pub const WARP_SYNC_PROTOCOL_ID: ProtocolId = *b"par"; @@ -150,7 +151,7 @@ impl Default for SyncConfig { pub type Notification = futures_mpsc::UnboundedReceiver; /// Current sync status -pub trait SyncProvider: Send + Sync { +pub trait SyncProvider: Send + Sync + PrometheusMetrics { /// Get sync status fn status(&self) -> EthSyncStatus; @@ -412,6 +413,52 @@ impl EthSync { } } +impl PrometheusMetrics for EthSync { + fn prometheus_metrics(&self, r: &mut prometheus::Registry) { + let scalar = |b| if b {1i64} else {0i64}; + let sync_status = self.status(); + + prometheus_gauge(r, + "sync_status", + "WaitingPeers(0), SnapshotManifest(1), SnapshotData(2), SnapshotWaiting(3), Blocks(4), Idle(5), Waiting(6), NewBlocks(7)", + match self.eth_handler.sync.status().state { + SyncState::WaitingPeers => 0, + SyncState::SnapshotManifest => 1, + SyncState::SnapshotData => 2, + SyncState::SnapshotWaiting => 3, + SyncState::Blocks => 4, + SyncState::Idle => 5, + SyncState::Waiting => 6, + SyncState::NewBlocks => 7, + }); + + prometheus_gauge(r, "net_peers", "Total number of connected peers", sync_status.num_peers as i64); + prometheus_gauge(r, "net_active_peers", "Total number of active peers", sync_status.num_active_peers as i64); + prometheus_counter(r, "sync_blocks_recieved", "Number of blocks downloaded so far", sync_status.blocks_received as i64); + prometheus_counter(r, "sync_blocks_total", "Total number of blocks for the sync process", sync_status.blocks_total as i64); + prometheus_gauge(r, "sync_blocks_highest", "Highest block number in the download queue", sync_status.highest_block_number.unwrap_or(0) as i64); + prometheus_gauge(r, "sync_is_majorsync", "Are we in the middle of a major sync?", scalar(self.is_major_syncing())); + prometheus_gauge(r, "sync_mem_used", "Heap memory used in bytes", sync_status.mem_used as i64); + prometheus_gauge(r, "snapshot_download_active", "1 if downloading snapshots", scalar(sync_status.is_snapshot_syncing())); + prometheus_gauge(r, "snapshot_download_chunks", "Snapshot chunks", sync_status.num_snapshot_chunks as i64); + prometheus_gauge(r, "snapshot_download_chunks_done", "Snapshot chunks downloaded", sync_status.snapshot_chunks_done as i64); + + let restoration = self.eth_handler.snapshot_service.restoration_status(); + let creation = self.eth_handler.snapshot_service.creation_status(); + + prometheus_gauge(r, "snapshot_create_block", "First block of the current snapshot creation", if let CreationStatus::Ongoing { block_number } = creation { + block_number as i64 + } else { + 0 + }); + prometheus_gauge(r, "snapshot_restore_block", "First block of the current snapshot restoration", if let RestorationStatus::Ongoing { block_number, ..} = restoration { + block_number as i64 + } else { + 0 + }); + } +} + impl SyncProvider for EthSync { /// Get sync status fn status(&self) -> EthSyncStatus { diff --git a/ethcore/sync/src/chain/handler.rs b/ethcore/sync/src/chain/handler.rs index 3cd53743e7b..effd9824e8a 100644 --- a/ethcore/sync/src/chain/handler.rs +++ b/ethcore/sync/src/chain/handler.rs @@ -512,7 +512,7 @@ impl SyncHandler { } // check service status - let status = io.snapshot_service().status(); + let status = io.snapshot_service().restoration_status(); match status { RestorationStatus::Inactive | RestorationStatus::Failed => { trace!(target: "snapshot_sync", "{}: Snapshot restoration status: {:?}", peer_id, status); diff --git a/ethcore/sync/src/chain/mod.rs b/ethcore/sync/src/chain/mod.rs index d7bce672c79..e4440dd0069 100644 --- a/ethcore/sync/src/chain/mod.rs +++ b/ethcore/sync/src/chain/mod.rs @@ -1169,8 +1169,8 @@ impl ChainSync { } }, SyncState::SnapshotData => { - match io.snapshot_service().status() { - RestorationStatus::Ongoing { state_chunks_done, block_chunks_done, state_chunks, block_chunks } => { + match io.snapshot_service().restoration_status() { + RestorationStatus::Ongoing { state_chunks_done, block_chunks_done, state_chunks, block_chunks, .. } => { // Initialize the snapshot if not already done self.snapshot.initialize(io.snapshot_service(), block_chunks as usize + state_chunks as usize); if self.snapshot.done_chunks() - (state_chunks_done + block_chunks_done) as usize > MAX_SNAPSHOT_CHUNKS_DOWNLOAD_AHEAD { @@ -1372,14 +1372,14 @@ impl ChainSync { self.set_state(SyncState::Blocks); self.continue_sync(io); }, - SyncState::SnapshotData => match io.snapshot_service().status() { + SyncState::SnapshotData => match io.snapshot_service().restoration_status() { RestorationStatus::Inactive | RestorationStatus::Failed => { self.set_state(SyncState::SnapshotWaiting); }, RestorationStatus::Initializing { .. } | RestorationStatus::Ongoing { .. } | RestorationStatus::Finalizing => (), }, SyncState::SnapshotWaiting => { - match io.snapshot_service().status() { + match io.snapshot_service().restoration_status() { RestorationStatus::Inactive => { trace!(target:"snapshot_sync", "Snapshot restoration is complete"); self.restart(io); diff --git a/ethcore/sync/src/tests/snapshot.rs b/ethcore/sync/src/tests/snapshot.rs index d0f44857c5a..5e1e7a95af9 100644 --- a/ethcore/sync/src/tests/snapshot.rs +++ b/ethcore/sync/src/tests/snapshot.rs @@ -30,7 +30,7 @@ use parking_lot::Mutex; use snapshot::SnapshotService; use common_types::{ BlockNumber, - snapshot::{ManifestData, RestorationStatus}, + snapshot::{ManifestData, CreationStatus, RestorationStatus}, }; #[derive(Default)] @@ -89,11 +89,12 @@ impl SnapshotService for TestSnapshotService { self.chunks.get(&hash).cloned() } - fn status(&self) -> RestorationStatus { + fn restoration_status(&self) -> RestorationStatus { match *self.restoration_manifest.lock() { Some(ref manifest) if self.state_restoration_chunks.lock().len() == manifest.state_hashes.len() && self.block_restoration_chunks.lock().len() == manifest.block_hashes.len() => RestorationStatus::Inactive, Some(ref manifest) => RestorationStatus::Ongoing { + block_number: 0, state_chunks: manifest.state_hashes.len() as u32, block_chunks: manifest.block_hashes.len() as u32, state_chunks_done: self.state_restoration_chunks.lock().len() as u32, @@ -102,6 +103,9 @@ impl SnapshotService for TestSnapshotService { None => RestorationStatus::Inactive, } } + fn creation_status(&self) -> CreationStatus { + CreationStatus::Inactive + } fn begin_restore(&self, manifest: ManifestData) { let mut restoration_manifest = self.restoration_manifest.lock(); diff --git a/ethcore/types/src/snapshot.rs b/ethcore/types/src/snapshot.rs index 1ecfe7e112c..ccb5339f8cd 100644 --- a/ethcore/types/src/snapshot.rs +++ b/ethcore/types/src/snapshot.rs @@ -183,6 +183,8 @@ pub enum RestorationStatus { }, /// Ongoing restoration. Ongoing { + /// Block number specified in the manifest. + block_number: u64, /// Total number of state chunks. state_chunks: u32, /// Total number of block chunks. @@ -197,3 +199,15 @@ pub enum RestorationStatus { /// Failed restoration. Failed, } + +/// Statuses for snapshot creation. +#[derive(PartialEq, Eq, Clone, Copy, Debug)] +pub enum CreationStatus { + /// No creation activity currently. + Inactive, + /// Snapshot creation is in progress. + Ongoing { + /// Current created snapshot. + block_number: u32, + } +} diff --git a/miner/Cargo.toml b/miner/Cargo.toml index 8b856c7f08a..00da99aa248 100644 --- a/miner/Cargo.toml +++ b/miner/Cargo.toml @@ -26,7 +26,7 @@ parity-util-mem = "0.7" keccak-hash = "0.5.0" linked-hash-map = "0.5" log = "0.4" -parity-runtime = "0.1.1" +parity-runtime = "0.1.2" parking_lot = "0.10.0" price-info = { path = "./price-info", optional = true } registrar = { path = "../util/registrar" } diff --git a/miner/price-info/Cargo.toml b/miner/price-info/Cargo.toml index 984e2db570c..a0391186337 100644 --- a/miner/price-info/Cargo.toml +++ b/miner/price-info/Cargo.toml @@ -11,9 +11,9 @@ edition = "2018" fetch = { path = "../../util/fetch" } futures = "0.1" log = "0.4" -parity-runtime = "0.1.1" +parity-runtime = "0.1.2" serde_json = "1.0" [dev-dependencies] fake-fetch = { path = "../../util/fake-fetch" } -parity-runtime = { version = "0.1.1", features = ["test-helpers"] } +parity-runtime = "0.1.2" diff --git a/parity/account.rs b/parity/account.rs index 48a4d9616fe..b44e41c5878 100644 --- a/parity/account.rs +++ b/parity/account.rs @@ -14,7 +14,7 @@ // You should have received a copy of the GNU General Public License // along with Open Ethereum. If not, see . -use params::SpecType; +use crate::params::SpecType; #[derive(Debug, PartialEq)] pub enum AccountCmd { @@ -68,7 +68,7 @@ mod command { use accounts::{AccountProvider, AccountProviderSettings}; use ethstore::{EthStore, SecretStore, SecretVaultRef, import_account, import_accounts, read_geth_accounts}; use ethstore::accounts_dir::RootDiskDirectory; - use helpers::{password_prompt, password_from_file}; + use crate::helpers::{password_prompt, password_from_file}; pub fn execute(cmd: AccountCmd) -> Result { match cmd { diff --git a/parity/account_utils.rs b/parity/account_utils.rs index 86c52d0c0f5..4e8cf34c8c6 100644 --- a/parity/account_utils.rs +++ b/parity/account_utils.rs @@ -16,11 +16,12 @@ use std::sync::Arc; +use crate::params::{SpecType, AccountsConfig}; + use dir::Directories; use ethereum_types::Address; use ethkey::Password; -use params::{SpecType, AccountsConfig}; #[cfg(not(feature = "accounts"))] mod accounts { @@ -60,11 +61,11 @@ mod accounts { #[cfg(feature = "accounts")] mod accounts { use super::*; - use upgrade::upgrade_key_location; + use crate::upgrade::upgrade_key_location; use ethereum_types::{H160, H256}; use std::str::FromStr; - pub use accounts::AccountProvider; + pub use crate::accounts::AccountProvider; /// Pops along with error messages when a password is missing or invalid. const VERIFY_PASSWORD_HINT: &str = "Make sure valid password is present in files passed using `--password` or in the configuration file."; @@ -73,7 +74,7 @@ mod accounts { pub fn prepare_account_provider(spec: &SpecType, dirs: &Directories, data_dir: &str, cfg: AccountsConfig, passwords: &[Password]) -> Result { use ethstore::EthStore; use ethstore::accounts_dir::RootDiskDirectory; - use accounts::AccountProviderSettings; + use crate::accounts::AccountProviderSettings; let path = dirs.keys_path(data_dir); upgrade_key_location(&dirs.legacy_keys_path(cfg.testnet), &path); diff --git a/parity/blockchain.rs b/parity/blockchain.rs index b1087452ebb..da213dc3378 100644 --- a/parity/blockchain.rs +++ b/parity/blockchain.rs @@ -21,6 +21,13 @@ use std::time::{Instant, Duration}; use std::thread::sleep; use std::sync::Arc; +use crate::cache::CacheConfig; +use crate::informant::{Informant, FullNodeInformantData}; +use crate::params::{SpecType, Pruning, Switch, tracing_switch_to_bool, fatdb_switch_to_bool}; +use crate::helpers::{to_client_config, execute_upgrades}; +use crate::user_defaults::UserDefaults; +use crate::db; + use rustc_hex::FromHex; use hash::{keccak, KECCAK_NULL_RLP}; use ethereum_types::{U256, H256, Address}; @@ -32,14 +39,8 @@ use ethcore::{ miner::Miner, }; use ethcore_service::ClientService; -use cache::CacheConfig; -use informant::{Informant, FullNodeInformantData}; -use params::{SpecType, Pruning, Switch, tracing_switch_to_bool, fatdb_switch_to_bool}; -use helpers::{to_client_config, execute_upgrades}; use dir::Directories; -use user_defaults::UserDefaults; use ethcore_private_tx; -use db; use ansi_term::Colour; use types::{ ids::BlockId, diff --git a/parity/cli/mod.rs b/parity/cli/mod.rs index 8bc107d2fc9..2762f85209f 100644 --- a/parity/cli/mod.rs +++ b/parity/cli/mod.rs @@ -563,6 +563,19 @@ usage! { "--ws-max-connections=[CONN]", "Maximum number of allowed concurrent WebSockets JSON-RPC connections.", + ["Metrics"] + FLAG flag_metrics: (bool) = false, or |c: &Config| c.metrics.as_ref()?.enable.clone(), + "--metrics", + "Enable prometheus metrics (only full client).", + + ARG arg_metrics_port: (u16) = 3000u16, or |c: &Config| c.metrics.as_ref()?.port.clone(), + "--metrics-port=[PORT]", + "Specify the port portion of the metrics server.", + + ARG arg_metrics_interface: (String) = "local", or |c: &Config| c.metrics.as_ref()?.interface.clone(), + "--metrics-interface=[IP]", + "Specify the hostname portion of the metrics server, IP should be an interface's IP address, or all (all interfaces) or local.", + ["API and Console Options – IPC"] FLAG flag_no_ipc: (bool) = false, or |c: &Config| c.ipc.as_ref()?.disable.clone(), "--no-ipc", @@ -1153,6 +1166,7 @@ struct Config { stratum: Option, whisper: Option, light: Option, + metrics: Option, } #[derive(Default, Debug, PartialEq, Deserialize)] @@ -1282,6 +1296,14 @@ struct Ipc { apis: Option>, } +#[derive(Default, Debug, PartialEq, Deserialize)] +#[serde(deny_unknown_fields)] +struct Metrics { + enable: Option, + port: Option, + interface: Option, +} + #[derive(Default, Debug, PartialEq, Deserialize)] #[serde(deny_unknown_fields)] struct Dapps { @@ -1432,7 +1454,7 @@ mod tests { use super::{ Args, ArgsError, Config, Operating, Account, Ui, Network, Ws, Rpc, Ipc, Dapps, Mining, Footprint, - Snapshots, Misc, Whisper, SecretStore, Light, + Snapshots, Misc, Whisper, SecretStore, Light, Metrics }; use toml; use clap::{ErrorKind as ClapErrorKind}; @@ -1820,6 +1842,12 @@ mod tests { arg_ipc_path: "$HOME/.parity/jsonrpc.ipc".into(), arg_ipc_apis: "web3,eth,net,parity,parity_accounts,personal,traces,rpc,secretstore".into(), arg_ipc_chmod: "660".into(), + + // METRICS + flag_metrics: false, + arg_metrics_port: 3000u16, + arg_metrics_interface: "local".into(), + // DAPPS arg_dapps_path: Some("$HOME/.parity/dapps".into()), flag_no_dapps: false, @@ -2087,6 +2115,11 @@ mod tests { chmod: None, apis: Some(vec!["rpc".into(), "eth".into()]), }), + metrics: Some(Metrics { + enable: Some(true), + interface: Some("local".to_string()), + port: Some(4000), + }), dapps: Some(Dapps { _legacy_disable: None, _legacy_port: Some(8080), diff --git a/parity/cli/tests/config.toml b/parity/cli/tests/config.toml index c95539ed63d..105a675fc55 100644 --- a/parity/cli/tests/config.toml +++ b/parity/cli/tests/config.toml @@ -37,6 +37,11 @@ server_threads = 13 [ipc] apis = ["rpc", "eth"] +[metrics] +enable = true +interface = "local" +port = 4000 + [dapps] port = 8080 user = "username" diff --git a/parity/configuration.rs b/parity/configuration.rs index 014eb813e4e..8f023e57771 100644 --- a/parity/configuration.rs +++ b/parity/configuration.rs @@ -21,7 +21,20 @@ use std::path::PathBuf; use std::collections::{HashSet, BTreeMap}; use std::iter::FromIterator; use std::cmp; -use cli::{Args, ArgsError}; +use crate::cli::{Args, ArgsError}; +use crate::rpc::{IpcConfiguration, HttpConfiguration, WsConfiguration}; +use crate::cache::CacheConfig; +use crate::helpers::{to_duration, to_mode, to_block_id, to_u256, to_pending_set, to_price, geth_ipc_path, parity_ipc_path, to_bootnodes, to_addresses, to_address, to_queue_strategy, to_queue_penalization}; +use crate::params::{ResealPolicy, AccountsConfig, GasPricerConfig, MinerExtras, SpecType}; +use crate::metrics::MetricsConfiguration; +use crate::secretstore::{NodeSecretKey, Configuration as SecretStoreConfiguration, ContractAddress as SecretStoreContractAddress}; +use crate::run::RunCmd; +use crate::blockchain::{BlockchainCmd, ImportBlockchain, ExportBlockchain, KillBlockchain, ExportState, ResetBlockchain}; +use crate::export_hardcoded_sync::ExportHsyncCmd; +use crate::presale::ImportWallet; +use crate::account::{AccountCmd, NewAccount, ListAccounts, ImportAccounts, ImportFromGethAccounts}; +use crate::snapshot_cmd::{self, SnapshotCommand}; + use hash::keccak; use ethereum_types::{U256, H256, Address}; use parity_version::{version_data, version}; @@ -34,24 +47,13 @@ use snapshot::SnapshotConfiguration; use miner::pool; use verification::queue::VerifierSettings; -use rpc::{IpcConfiguration, HttpConfiguration, WsConfiguration}; use parity_rpc::NetworkSettings; -use cache::CacheConfig; -use helpers::{to_duration, to_mode, to_block_id, to_u256, to_pending_set, to_price, geth_ipc_path, parity_ipc_path, to_bootnodes, to_addresses, to_address, to_queue_strategy, to_queue_penalization}; use dir::helpers::{replace_home, replace_home_and_local}; -use params::{ResealPolicy, AccountsConfig, GasPricerConfig, MinerExtras, SpecType}; use ethcore_logger::Config as LogConfig; use dir::{self, Directories, default_hypervisor_path, default_local_path, default_data_path}; use ethcore_private_tx::{ProviderConfig, EncryptorConfig}; -use secretstore::{NodeSecretKey, Configuration as SecretStoreConfiguration, ContractAddress as SecretStoreContractAddress}; use updater::{UpdatePolicy, UpdateFilter, ReleaseTrack}; -use run::RunCmd; use types::data_format::DataFormat; -use blockchain::{BlockchainCmd, ImportBlockchain, ExportBlockchain, KillBlockchain, ExportState, ResetBlockchain}; -use export_hardcoded_sync::ExportHsyncCmd; -use presale::ImportWallet; -use account::{AccountCmd, NewAccount, ListAccounts, ImportAccounts, ImportFromGethAccounts}; -use snapshot_cmd::{self, SnapshotCommand}; use network::{IpFilter, NatType}; const DEFAULT_MAX_PEERS: u16 = 50; @@ -140,6 +142,7 @@ impl Configuration { let experimental_rpcs = self.args.flag_jsonrpc_experimental; let secretstore_conf = self.secretstore_config()?; let format = self.format()?; + let metrics_conf = self.metrics_config()?; let key_iterations = self.args.arg_keys_iterations; if key_iterations == 0 { @@ -149,7 +152,7 @@ impl Configuration { let cmd = if self.args.flag_version { Cmd::Version } else if self.args.cmd_signer { - let authfile = ::signer::codes_path(&ws_conf.signer_path); + let authfile = crate::signer::codes_path(&ws_conf.signer_path); if self.args.cmd_signer_new_token { Cmd::SignerToken(ws_conf, logger_config.clone()) @@ -414,6 +417,7 @@ impl Configuration { on_demand_request_backoff_rounds_max: self.args.arg_on_demand_request_backoff_rounds_max, on_demand_request_consecutive_failures: self.args.arg_on_demand_request_consecutive_failures, sync_until: self.args.arg_sync_until, + metrics_conf, }; Cmd::Run(run_cmd) }; @@ -902,6 +906,15 @@ impl Configuration { Ok(conf) } + fn metrics_config(&self) -> Result { + let conf = MetricsConfiguration { + enabled: self.metrics_enabled(), + interface: self.metrics_interface(), + port: self.args.arg_ports_shift + self.args.arg_metrics_port, + }; + Ok(conf) + } + fn private_provider_config(&self) -> Result<(ProviderConfig, EncryptorConfig, bool), String> { let dirs = self.directories(); let provider_conf = ProviderConfig { @@ -1040,6 +1053,10 @@ impl Configuration { self.interface(&self.args.arg_ws_interface) } + fn metrics_interface(&self) -> String { + self.interface(&self.args.arg_metrics_interface) + } + fn secretstore_interface(&self) -> String { self.interface(&self.args.arg_secretstore_interface) } @@ -1107,6 +1124,10 @@ impl Configuration { !self.args.flag_no_ws } + fn metrics_enabled(&self) -> bool { + self.args.flag_metrics + } + fn secretstore_enabled(&self) -> bool { !self.args.flag_no_secretstore && cfg!(feature = "secretstore") } @@ -1179,16 +1200,16 @@ mod tests { use updater::{UpdatePolicy, UpdateFilter, ReleaseTrack}; use types::ids::BlockId; use types::data_format::DataFormat; - use account::{AccountCmd, NewAccount, ImportAccounts, ListAccounts}; - use blockchain::{BlockchainCmd, ImportBlockchain, ExportBlockchain, ExportState}; - use cli::Args; + use crate::account::{AccountCmd, NewAccount, ImportAccounts, ListAccounts}; + use crate::blockchain::{BlockchainCmd, ImportBlockchain, ExportBlockchain, ExportState}; + use crate::cli::Args; use dir::{Directories, default_hypervisor_path}; - use helpers::{default_network_config}; - use params::SpecType; - use presale::ImportWallet; - use rpc::WsConfiguration; - use rpc_apis::ApiSet; - use run::RunCmd; + use crate::helpers::{default_network_config}; + use crate::params::SpecType; + use crate::presale::ImportWallet; + use crate::rpc::WsConfiguration; + use crate::rpc_apis::ApiSet; + use crate::run::RunCmd; use network::{AllowIP, IpFilter}; @@ -1455,6 +1476,7 @@ mod tests { on_demand_request_backoff_rounds_max: None, on_demand_request_consecutive_failures: None, sync_until: None, + metrics_conf: MetricsConfiguration::default(), }; expected.secretstore_conf.enabled = cfg!(feature = "secretstore"); expected.secretstore_conf.http_enabled = cfg!(feature = "secretstore"); diff --git a/parity/db/rocksdb/mod.rs b/parity/db/rocksdb/mod.rs index 93342726135..806e33ce271 100644 --- a/parity/db/rocksdb/mod.rs +++ b/parity/db/rocksdb/mod.rs @@ -24,6 +24,9 @@ extern crate tempfile; use std::{io, fs}; use std::sync::Arc; use std::path::Path; + +use crate::cache::CacheConfig; + use blooms_db; use ethcore_db::NUM_COLUMNS; use ethcore::client::{ClientConfig, DatabaseCompactionProfile}; @@ -31,7 +34,6 @@ use kvdb::KeyValueDB; use self::ethcore_blockchain::{BlockChainDBHandler, BlockChainDB}; use self::kvdb_rocksdb::{Database, DatabaseConfig}; -use cache::CacheConfig; mod migration; mod helpers; diff --git a/parity/deprecated.rs b/parity/deprecated.rs index 5ca56d57adc..960d678c180 100644 --- a/parity/deprecated.rs +++ b/parity/deprecated.rs @@ -15,7 +15,7 @@ // along with Open Ethereum. If not, see . use std::fmt; -use cli::Args; +use crate::cli::Args; #[derive(Debug, PartialEq)] pub enum Deprecated { @@ -248,7 +248,7 @@ pub fn find_deprecated(args: &Args) -> Vec { #[cfg(test)] mod tests { - use cli::Args; + use crate::cli::Args; use super::{Deprecated, find_deprecated}; #[test] diff --git a/parity/export_hardcoded_sync.rs b/parity/export_hardcoded_sync.rs index c404343d72e..d2b11924e97 100644 --- a/parity/export_hardcoded_sync.rs +++ b/parity/export_hardcoded_sync.rs @@ -17,17 +17,19 @@ use std::sync::Arc; use std::time::Duration; +use crate::params::{SpecType, Pruning}; +use crate::helpers::execute_upgrades; +use crate::cache::CacheConfig; +use crate::user_defaults::UserDefaults; +use crate::db; + use ethcore::client::DatabaseCompactionProfile; use spec::SpecParams; use light::client::fetch::Unavailable as UnavailableDataFetcher; use light::Cache as LightDataCache; use types::engines::OptimizeFor; -use params::{SpecType, Pruning}; -use helpers::execute_upgrades; use dir::Directories; -use cache::CacheConfig; -use user_defaults::UserDefaults; -use db; + // Number of minutes before a given gas price corpus should expire. // Light client only. diff --git a/parity/helpers.rs b/parity/helpers.rs index 22deb00c99d..faad0665e3e 100644 --- a/parity/helpers.rs +++ b/parity/helpers.rs @@ -19,18 +19,21 @@ use std::io::{Write, BufReader, BufRead}; use std::time::Duration; use std::fs::File; use std::collections::HashSet; + +use crate::cache::CacheConfig; +use crate::upgrade::{upgrade, upgrade_data_paths}; +use crate::db::migrate; + use ethereum_types::{U256, Address}; use journaldb::Algorithm; use ethcore::client::{DatabaseCompactionProfile, ClientConfig}; use ethcore::miner::{PendingSet, Penalization}; use verification::VerifierType; use miner::pool::PrioritizationStrategy; -use cache::CacheConfig; + use dir::DatabaseDirectories; use dir::helpers::replace_home; -use upgrade::{upgrade, upgrade_data_paths}; use sync::{validate_node_url, self}; -use db::migrate; use path; use ethkey::Password; use types::{ diff --git a/parity/informant.rs b/parity/informant.rs index d4e81deda2d..25c62100c8f 100644 --- a/parity/informant.rs +++ b/parity/informant.rs @@ -276,7 +276,7 @@ impl Informant { let rpc_stats = self.rpc_stats.as_ref(); let snapshot_sync = sync_info.as_ref().map_or(false, |s| s.snapshot_sync) && self.snapshot.as_ref().map_or(false, |s| - match s.status() { + match s.restoration_status() { RestorationStatus::Ongoing { .. } | RestorationStatus::Initializing { .. } => true, _ => false, } @@ -315,8 +315,8 @@ impl Informant { ), true => { self.snapshot.as_ref().map_or(String::new(), |s| - match s.status() { - RestorationStatus::Ongoing { state_chunks, block_chunks, state_chunks_done, block_chunks_done } => { + match s.restoration_status() { + RestorationStatus::Ongoing { state_chunks, block_chunks, state_chunks_done, block_chunks_done, .. } => { format!("Syncing snapshot {}/{}", state_chunks_done + block_chunks_done, state_chunks + block_chunks) }, RestorationStatus::Initializing { chunks_done, state_chunks, block_chunks } => { diff --git a/parity/lib.rs b/parity/lib.rs index f8be172fa0e..4bad1be5c90 100644 --- a/parity/lib.rs +++ b/parity/lib.rs @@ -58,6 +58,7 @@ extern crate ethcore_sync as sync; extern crate ethereum_types; extern crate ethkey; extern crate ethstore; +extern crate hyper; extern crate journaldb; extern crate keccak_hash as hash; extern crate kvdb; @@ -74,7 +75,9 @@ extern crate parity_version; extern crate registrar; extern crate snapshot; extern crate spec; +extern crate stats; extern crate verification; +extern crate prometheus; #[macro_use] extern crate log as rlog; @@ -109,6 +112,7 @@ mod deprecated; mod helpers; mod informant; mod light_helpers; +mod metrics; mod modules; mod params; mod presale; diff --git a/parity/main.rs b/parity/main.rs index 0c2b98d02ef..d4f9c411ca0 100644 --- a/parity/main.rs +++ b/parity/main.rs @@ -28,6 +28,7 @@ extern crate openethereum; extern crate parking_lot; extern crate parity_daemonize; extern crate ansi_term; +extern crate tokio; #[cfg(windows)] extern crate winapi; extern crate ethcore_logger; diff --git a/parity/metrics.rs b/parity/metrics.rs new file mode 100644 index 00000000000..90b2da96138 --- /dev/null +++ b/parity/metrics.rs @@ -0,0 +1,115 @@ +use std::{ + time::Instant, + sync::Arc +}; + +use crate::{ + rpc, + rpc_apis +}; + +use parking_lot::Mutex; + +use hyper::{ + Method, Body, Request, Response, Server, StatusCode, + service::{make_service_fn, service_fn} +}; + +use stats::{ + PrometheusMetrics, + prometheus_gauge, + prometheus::{self, Encoder} +}; + +#[derive(Debug, Clone, PartialEq)] +pub struct MetricsConfiguration { + /// Are metrics enabled (default is false)? + pub enabled: bool, + /// The IP of the network interface used (default is 127.0.0.1). + pub interface: String, + /// The network port (default is 3000). + pub port: u16, +} + +impl Default for MetricsConfiguration { + fn default() -> Self { + MetricsConfiguration { + enabled: false, + interface: "127.0.0.1".into(), + port: 3000, + } + } +} + +struct State { + rpc_apis: Arc, +} + +async fn handle_request(req: Request, state: Arc>) -> Response { + let (parts, _body) = req.into_parts(); + match (parts.method, parts.uri.path()) { + (Method::GET, "/metrics") => { + + tokio::task::spawn_blocking(move || { + let start = Instant::now(); + + let mut reg = prometheus::Registry::new(); + let state = state.lock(); + state.rpc_apis.client.prometheus_metrics(&mut reg); + state.rpc_apis.sync.prometheus_metrics(&mut reg); + let elapsed = start.elapsed(); + prometheus_gauge(&mut reg, "metrics_time", "Time to perform rpc metrics", elapsed.as_millis() as i64); + + let mut buffer = vec![]; + let encoder = prometheus::TextEncoder::new(); + let metric_families = reg.gather(); + + encoder.encode(&metric_families, &mut buffer).expect("all source of metrics are static; qed"); + let text = String::from_utf8(buffer).expect("metrics encoding is ASCII; qed"); + + Response::new(Body::from(text)) + + }).await.expect("The prometheus collection has panicked") + + }, + (_, _) => { + let mut res = Response::new(Body::from("not found")); + *res.status_mut() = StatusCode::NOT_FOUND; + res + } + } +} + +/// Start the prometheus metrics server accessible via GET :/metrics +pub fn start_prometheus_metrics(conf: &MetricsConfiguration, deps: &rpc::Dependencies) -> Result<(), String> { + + if !conf.enabled { + return Ok(()); + } + + let addr = format!("{}:{}", conf.interface, conf.port); + let addr = addr + .parse() + .map_err(|err| format!("Failed to parse address '{}': {}", addr,err))?; + + let state = State { + rpc_apis: deps.apis.clone(), + }; + let state = Arc::new(Mutex::new(state)); + + deps.executor.spawn_std( async move { + let make_service = make_service_fn(move |_| { + let state = state.clone(); + async move { + Ok::<_, hyper::Error>(service_fn(move |req| { + let response = handle_request(req, state.clone()); + async move { Ok::<_, hyper::Error>(response.await) } + })) + } + }); + Server::bind(&addr).serve(make_service).await + .expect("unable to create prometheus service."); + }); + + Ok(()) +} diff --git a/parity/params.rs b/parity/params.rs index 173121b87ec..c0746b011dc 100644 --- a/parity/params.rs +++ b/parity/params.rs @@ -18,6 +18,8 @@ use std::collections::HashSet; use std::time::Duration; use std::{str, fs, fmt}; +use crate::user_defaults::UserDefaults; + use spec::{Spec, SpecParams, self}; use ethereum_types::{U256, Address}; use parity_runtime::Executor; @@ -26,7 +28,6 @@ use journaldb::Algorithm; use miner::gas_pricer::GasPricer; use miner::gas_price_calibrator::{GasPriceCalibratorOptions, GasPriceCalibrator}; use parity_version::version_data; -use user_defaults::UserDefaults; use types::client_types::Mode; use crate::configuration; @@ -367,7 +368,7 @@ pub fn mode_switch_to_bool(switch: Option, user_defaults: &UserDefaults) - #[cfg(test)] mod tests { use journaldb::Algorithm; - use user_defaults::UserDefaults; + use crate::user_defaults::UserDefaults; use super::{SpecType, Pruning, ResealPolicy, Switch, tracing_switch_to_bool}; #[test] diff --git a/parity/presale.rs b/parity/presale.rs index 21543e6da81..f7a125905f6 100644 --- a/parity/presale.rs +++ b/parity/presale.rs @@ -14,11 +14,11 @@ // You should have received a copy of the GNU General Public License // along with Open Ethereum. If not, see . +use crate::helpers::{password_prompt, password_from_file}; +use crate::params::SpecType; use ethkey::Password; use ethstore::PresaleWallet; -use helpers::{password_prompt, password_from_file}; -use params::SpecType; #[derive(Debug, PartialEq)] pub struct ImportWallet { diff --git a/parity/rpc.rs b/parity/rpc.rs index d089b70cd4e..994957a4fe9 100644 --- a/parity/rpc.rs +++ b/parity/rpc.rs @@ -19,14 +19,15 @@ use std::sync::Arc; use std::path::PathBuf; use std::collections::HashSet; +use crate::rpc_apis::{self, ApiSet}; +use crate::helpers::parity_ipc_path; + use dir::default_data_path; use dir::helpers::replace_home; -use helpers::parity_ipc_path; use jsonrpc_core::MetaIoHandler; use parity_runtime::Executor; use parity_rpc::informant::{RpcStats, Middleware}; use parity_rpc::{self as rpc, Metadata, DomainsValidation}; -use rpc_apis::{self, ApiSet}; pub use parity_rpc::{IpcServer, HttpServer, RequestMiddleware}; pub use parity_rpc::ws::{Server as WsServer, ws}; @@ -179,7 +180,7 @@ pub fn new_ws( let signer_path; let path = match conf.support_token_api { true => { - signer_path = ::signer::codes_path(&conf.signer_path); + signer_path = crate::signer::codes_path(&conf.signer_path); Some(signer_path.as_path()) }, false => None diff --git a/parity/rpc_apis.rs b/parity/rpc_apis.rs index 5cbd1c7594b..53589af5118 100644 --- a/parity/rpc_apis.rs +++ b/parity/rpc_apis.rs @@ -19,9 +19,10 @@ use std::collections::{BTreeMap, HashSet}; use std::str::FromStr; use std::sync::{Arc, Weak}; +use crate::account_utils::{self, AccountProvider}; + pub use parity_rpc::signer::SignerService; -use account_utils::{self, AccountProvider}; use ethcore::client::Client; use ethcore::miner::Miner; use snapshot::SnapshotService; diff --git a/parity/run.rs b/parity/run.rs index 71d5d8cfc56..73cd51031af 100644 --- a/parity/run.rs +++ b/parity/run.rs @@ -19,6 +19,26 @@ use std::sync::{Arc, Weak, atomic}; use std::time::{Duration, Instant}; use std::thread; +use crate::informant::{Informant, LightNodeInformantData, FullNodeInformantData}; +use crate::metrics::{MetricsConfiguration, start_prometheus_metrics}; +use crate::miner::external::ExternalMiner; +use crate::miner::work_notify::WorkPoster; +use crate::params::{ + SpecType, Pruning, AccountsConfig, GasPricerConfig, MinerExtras, Switch, + tracing_switch_to_bool, fatdb_switch_to_bool, mode_switch_to_bool +}; +use crate::account_utils; +use crate::helpers::{to_client_config, execute_upgrades, passwords_from_files}; +use crate::cache::CacheConfig; +use crate::user_defaults::UserDefaults; +use crate::jsonrpc_core; +use crate::modules; +use crate::rpc; +use crate::rpc_apis; +use crate::secretstore; +use crate::signer; +use crate::db; + use ansi_term::Colour; use client_traits::{BlockInfo, BlockChainClient}; use ethcore::client::{Client, DatabaseCompactionProfile}; @@ -30,11 +50,8 @@ use ethcore_logger::{Config as LogConfig, RotatingLogger}; use ethcore_service::ClientService; use futures::Stream; use hash_fetch::{self, fetch}; -use informant::{Informant, LightNodeInformantData, FullNodeInformantData}; use journaldb::Algorithm; use light::Cache as LightDataCache; -use miner::external::ExternalMiner; -use miner::work_notify::WorkPoster; use node_filter::NodeFilter; use parity_runtime::Runtime; use sync::{self, SyncConfig, PrivateTxHandler}; @@ -49,22 +66,7 @@ use parity_rpc::{ use updater::{UpdateFilter, UpdatePolicy, Updater}; use parity_version::version; use ethcore_private_tx::{ProviderConfig, EncryptorConfig, SecretStoreEncryptor}; -use params::{ - SpecType, Pruning, AccountsConfig, GasPricerConfig, MinerExtras, Switch, - tracing_switch_to_bool, fatdb_switch_to_bool, mode_switch_to_bool -}; -use account_utils; -use helpers::{to_client_config, execute_upgrades, passwords_from_files}; use dir::{Directories, DatabaseDirectories}; -use cache::CacheConfig; -use user_defaults::UserDefaults; -use jsonrpc_core; -use modules; -use rpc; -use rpc_apis; -use secretstore; -use signer; -use db; use registrar::RegistrarClient; // How often we attempt to take a snapshot: only snapshot on blocknumbers that are multiples of this. @@ -138,6 +140,7 @@ pub struct RunCmd { pub on_demand_request_backoff_rounds_max: Option, pub on_demand_request_consecutive_failures: Option, pub sync_until: Option, + pub metrics_conf: MetricsConfiguration, } // node info fetcher for the local store. @@ -162,7 +165,7 @@ impl ::local_store::NodeInfo for FullNodeInfo { } } -type LightClient = ::light::client::Client<::light_helpers::EpochFetch>; +type LightClient = crate::light::client::Client; // helper for light execution. fn execute_light_impl(cmd: RunCmd, logger: Arc, on_client_rq: Cr) -> Result @@ -246,7 +249,7 @@ fn execute_light_impl(cmd: RunCmd, logger: Arc, on_client_rq }); let sync_handle = Arc::new(RwLock::new(Weak::new())); - let fetch = ::light_helpers::EpochFetch { + let fetch = crate::light_helpers::EpochFetch { on_demand: on_demand.clone(), sync: sync_handle.clone(), }; @@ -759,6 +762,9 @@ fn execute_impl( let ipc_server = rpc::new_ipc(cmd.ipc_conf, &dependencies)?; let http_server = rpc::new_http("HTTP JSON-RPC", "jsonrpc", cmd.http_conf.clone(), &dependencies)?; + // start the prometheus metrics server + start_prometheus_metrics(&cmd.metrics_conf, &dependencies)?; + // secret store key server let secretstore_deps = secretstore::Dependencies { client: client.clone(), diff --git a/parity/secretstore/server.rs b/parity/secretstore/server.rs index 4c556adbc92..c7de3d1f6f1 100644 --- a/parity/secretstore/server.rs +++ b/parity/secretstore/server.rs @@ -19,7 +19,8 @@ use std::collections::BTreeMap; use std::sync::Arc; -use account_utils::AccountProvider; +use crate::account_utils::AccountProvider; + use dir::default_data_path; use dir::helpers::replace_home; use ethcore::client::Client; diff --git a/parity/signer.rs b/parity/signer.rs index ad834294aba..d1681a71571 100644 --- a/parity/signer.rs +++ b/parity/signer.rs @@ -17,10 +17,11 @@ use std::io; use std::path::{Path, PathBuf}; +use crate::rpc; +use crate::rpc_apis; + use ansi_term::Colour::White; use ethcore_logger::Config as LogConfig; -use rpc; -use rpc_apis; use parity_rpc; use path::restrict_permissions_owner; diff --git a/parity/snapshot_cmd.rs b/parity/snapshot_cmd.rs index 0f27e0886bd..76c46394af9 100644 --- a/parity/snapshot_cmd.rs +++ b/parity/snapshot_cmd.rs @@ -20,6 +20,12 @@ use std::time::Duration; use std::path::{Path, PathBuf}; use std::sync::Arc; +use crate::cache::CacheConfig; +use crate::params::{SpecType, Pruning, Switch, tracing_switch_to_bool, fatdb_switch_to_bool}; +use crate::helpers::{to_client_config, execute_upgrades}; +use crate::user_defaults::UserDefaults; +use crate::db; + use hash::keccak; use snapshot::{SnapshotConfiguration, SnapshotService as SS, SnapshotClient}; use snapshot::io::{SnapshotReader, PackedReader, PackedWriter}; @@ -35,13 +41,9 @@ use types::{ snapshot::RestorationStatus, }; -use cache::CacheConfig; -use params::{SpecType, Pruning, Switch, tracing_switch_to_bool, fatdb_switch_to_bool}; -use helpers::{to_client_config, execute_upgrades}; + use dir::Directories; -use user_defaults::UserDefaults; use ethcore_private_tx; -use db; /// Kinds of snapshot commands. #[derive(Debug, PartialEq, Clone, Copy)] @@ -86,7 +88,7 @@ fn restore_using(snapshot: Arc>, read let informant_handle = snapshot.clone(); ::std::thread::spawn(move || { - while let RestorationStatus::Ongoing { state_chunks_done, block_chunks_done, .. } = informant_handle.status() { + while let RestorationStatus::Ongoing { state_chunks_done, block_chunks_done, .. } = informant_handle.restoration_status() { info!("Processed {}/{} state chunks and {}/{} block chunks.", state_chunks_done, num_state, block_chunks_done, num_blocks); ::std::thread::sleep(Duration::from_secs(5)); @@ -95,7 +97,7 @@ fn restore_using(snapshot: Arc>, read info!("Restoring state"); for &state_hash in &manifest.state_hashes { - if snapshot.status() == RestorationStatus::Failed { + if snapshot.restoration_status() == RestorationStatus::Failed { return Err("Restoration failed".into()); } @@ -112,7 +114,7 @@ fn restore_using(snapshot: Arc>, read info!("Restoring blocks"); for &block_hash in &manifest.block_hashes { - if snapshot.status() == RestorationStatus::Failed { + if snapshot.restoration_status() == RestorationStatus::Failed { return Err("Restoration failed".into()); } @@ -126,7 +128,7 @@ fn restore_using(snapshot: Arc>, read snapshot.feed_block_chunk(block_hash, &chunk); } - match snapshot.status() { + match snapshot.restoration_status() { RestorationStatus::Ongoing { .. } => Err("Snapshot file is incomplete and missing chunks.".into()), RestorationStatus::Initializing { .. } => Err("Snapshot restoration is still initializing.".into()), RestorationStatus::Finalizing => Err("Snapshot restoration is still finalizing.".into()), @@ -270,7 +272,7 @@ impl SnapshotCommand { let cur_size = progress.bytes(); if cur_size != last_size { last_size = cur_size; - let bytes = ::informant::format_bytes(cur_size); + let bytes = crate::informant::format_bytes(cur_size); info!("Snapshot: {} accounts (state), {} blocks, {} bytes", progress.accounts(), progress.blocks(), bytes); } } else { diff --git a/rpc/Cargo.toml b/rpc/Cargo.toml index 7ec5fb74d33..c370204829a 100644 --- a/rpc/Cargo.toml +++ b/rpc/Cargo.toml @@ -57,7 +57,7 @@ ethkey = { path = "../accounts/ethkey" } ethstore = { path = "../accounts/ethstore" } fetch = { path = "../util/fetch" } keccak-hash = "0.5.0" -parity-runtime = { version = "0.1.1", features = ["test-helpers"] } +parity-runtime = { version = "0.1.2", features = ["test-helpers"] } parity-updater = { path = "../updater" } parity-version = { path = "../util/version" } rlp = "0.4.5" diff --git a/rpc/src/v1/impls/eth.rs b/rpc/src/v1/impls/eth.rs index fa28a7e4303..d0143a3e63e 100644 --- a/rpc/src/v1/impls/eth.rs +++ b/rpc/src/v1/impls/eth.rs @@ -551,10 +551,10 @@ impl Eth for EthClient< fn syncing(&self) -> Result { let status = self.sync.status(); let client = &self.client; - let snapshot_status = self.snapshot.status(); + let snapshot_status = self.snapshot.restoration_status(); let (warping, warp_chunks_amount, warp_chunks_processed) = match snapshot_status { - RestorationStatus::Ongoing { state_chunks, block_chunks, state_chunks_done, block_chunks_done } => + RestorationStatus::Ongoing { state_chunks, block_chunks, state_chunks_done, block_chunks_done, .. } => (true, Some(block_chunks + state_chunks), Some(block_chunks_done + state_chunks_done)), _ => (false, None, None), }; diff --git a/rpc/src/v1/impls/parity.rs b/rpc/src/v1/impls/parity.rs index cbb89a8ca95..dc63831dadf 100644 --- a/rpc/src/v1/impls/parity.rs +++ b/rpc/src/v1/impls/parity.rs @@ -39,6 +39,7 @@ use types::{ }; use updater::{Service as UpdateService}; use version::version_data; +use stats::PrometheusMetrics; use v1::helpers::{self, errors, fake_sign, NetworkSettings, verify_signature}; use v1::helpers::external_signer::{SigningQueue, SignerService}; @@ -70,7 +71,7 @@ pub struct ParityClient { } impl ParityClient where - C: BlockChainClient, + C: BlockChainClient + PrometheusMetrics, { /// Creates new `ParityClient`. pub fn new( @@ -102,7 +103,7 @@ impl ParityClient where impl Parity for ParityClient where S: StateInfo + 'static, - C: miner::BlockChainClient + BlockChainClient + StateClient + Call + 'static, + C: miner::BlockChainClient + BlockChainClient + PrometheusMetrics + StateClient + Call + 'static, M: MinerService + 'static, U: UpdateService + 'static, { @@ -439,7 +440,7 @@ impl Parity for ParityClient where fn status(&self) -> Result<()> { let has_peers = self.settings.is_dev_chain || self.sync.status().num_peers > 0; - let is_warping = match self.snapshot.as_ref().map(|s| s.status()) { + let is_warping = match self.snapshot.as_ref().map(|s| s.restoration_status()) { Some(RestorationStatus::Ongoing { .. }) => true, _ => false, }; diff --git a/rpc/src/v1/tests/helpers/snapshot_service.rs b/rpc/src/v1/tests/helpers/snapshot_service.rs index 7bf66d66127..c3dfbcfe0d7 100644 --- a/rpc/src/v1/tests/helpers/snapshot_service.rs +++ b/rpc/src/v1/tests/helpers/snapshot_service.rs @@ -19,7 +19,7 @@ use snapshot::SnapshotService; use bytes::Bytes; use ethereum_types::H256; use parking_lot::Mutex; -use types::snapshot::{ManifestData, RestorationStatus}; +use types::snapshot::{ManifestData, CreationStatus, RestorationStatus}; /// Mocked snapshot service (used for sync info extensions). pub struct TestSnapshotService { @@ -46,7 +46,8 @@ impl SnapshotService for TestSnapshotService { fn supported_versions(&self) -> Option<(u64, u64)> { None } fn completed_chunks(&self) -> Option> { Some(vec![]) } fn chunk(&self, _hash: H256) -> Option { None } - fn status(&self) -> RestorationStatus { self.status.lock().clone() } + fn restoration_status(&self) -> RestorationStatus { self.status.lock().clone() } + fn creation_status(&self) -> CreationStatus { CreationStatus::Inactive } fn begin_restore(&self, _manifest: ManifestData) { } fn abort_restore(&self) { } fn restore_state_chunk(&self, _hash: H256, _chunk: Bytes) { } diff --git a/rpc/src/v1/tests/helpers/sync_provider.rs b/rpc/src/v1/tests/helpers/sync_provider.rs index 27fd16ba7c0..5952f48a1be 100644 --- a/rpc/src/v1/tests/helpers/sync_provider.rs +++ b/rpc/src/v1/tests/helpers/sync_provider.rs @@ -22,6 +22,7 @@ use parking_lot::RwLock; use network::client_version::ClientVersion; use futures::sync::mpsc; use sync::{SyncProvider, EthProtocolInfo, SyncStatus, PeerInfo, TransactionStats, SyncState}; +use stats::{PrometheusMetrics, prometheus}; /// TestSyncProvider config. pub struct Config { @@ -72,6 +73,11 @@ impl TestSyncProvider { } } +impl PrometheusMetrics for TestSyncProvider { + fn prometheus_metrics(&self, _: &mut prometheus::Registry) { + } +} + impl SyncProvider for TestSyncProvider { fn status(&self) -> SyncStatus { self.status.read().clone() diff --git a/rpc/src/v1/tests/mocked/eth.rs b/rpc/src/v1/tests/mocked/eth.rs index 5f81c1a65c0..2b8e6e02a9c 100644 --- a/rpc/src/v1/tests/mocked/eth.rs +++ b/rpc/src/v1/tests/mocked/eth.rs @@ -157,6 +157,7 @@ fn rpc_eth_syncing() { let snap_res = r#"{"jsonrpc":"2.0","result":{"currentBlock":"0x3e8","highestBlock":"0x9c4","startingBlock":"0x0","warpChunksAmount":"0x32","warpChunksProcessed":"0x18"},"id":1}"#; tester.snapshot.set_status(RestorationStatus::Ongoing { + block_number: 0, state_chunks: 40, block_chunks: 10, state_chunks_done: 18, diff --git a/scripts/prometheus/config/grafana/dashboards/oe.json b/scripts/prometheus/config/grafana/dashboards/oe.json new file mode 100644 index 00000000000..17beec651ba --- /dev/null +++ b/scripts/prometheus/config/grafana/dashboards/oe.json @@ -0,0 +1,1576 @@ +{ + "annotations": { + "list": [ + { + "builtIn": 1, + "datasource": "-- Grafana --", + "enable": true, + "hide": true, + "iconColor": "rgba(0, 211, 255, 1)", + "name": "Annotations & Alerts", + "type": "dashboard" + } + ] + }, + "editable": true, + "gnetId": null, + "graphTooltip": 0, + "id": 3, + "links": [], + "panels": [ + { + "cacheTimeout": null, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": { + "align": null + }, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 4, + "x": 0, + "y": 0 + }, + "id": 20, + "interval": "", + "links": [], + "maxDataPoints": 0, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "mean" + ], + "fields": "", + "values": false + } + }, + "pluginVersion": "7.0.3", + "targets": [ + { + "expr": "oe_sync_blocks_highest", + "interval": "", + "legendFormat": "", + "refId": "A" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "Highest block", + "transformations": [ + { + "id": "reduce", + "options": {} + } + ], + "type": "stat" + }, + { + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {}, + "mappings": [], + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "green", + "value": null + }, + { + "color": "red", + "value": 80 + } + ] + } + }, + "overrides": [] + }, + "gridPos": { + "h": 3, + "w": 2, + "x": 4, + "y": 0 + }, + "id": 29, + "options": { + "colorMode": "value", + "graphMode": "area", + "justifyMode": "auto", + "orientation": "auto", + "reduceOptions": { + "calcs": [ + "mean" + ], + "fields": "", + "values": false + } + }, + "pluginVersion": "7.0.3", + "targets": [ + { + "expr": "oe_prunning_earliest_state", + "interval": "", + "legendFormat": "", + "refId": "A" + } + ], + "timeFrom": null, + "timeShift": null, + "title": "Earliest non pruned state", + "transformations": [ + { + "id": "reduce", + "options": {} + } + ], + "type": "stat" + }, + { + "cacheTimeout": null, + "colorBackground": false, + "colorValue": false, + "colors": [ + "#299c46", + "rgba(237, 129, 40, 0.89)", + "#d44a3a" + ], + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "format": "none", + "gauge": { + "maxValue": 100, + "minValue": 0, + "show": false, + "thresholdLabels": false, + "thresholdMarkers": true + }, + "gridPos": { + "h": 2, + "w": 3, + "x": 6, + "y": 0 + }, + "id": 24, + "interval": null, + "links": [], + "mappingType": 1, + "mappingTypes": [ + { + "name": "value to text", + "value": 1 + }, + { + "name": "range to text", + "value": 2 + } + ], + "maxDataPoints": 100, + "nullPointMode": "connected", + "nullText": null, + "postfix": "", + "postfixFontSize": "50%", + "prefix": "", + "prefixFontSize": "50%", + "rangeMaps": [ + { + "from": "null", + "text": "N/A", + "to": "null" + } + ], + "sparkline": { + "fillColor": "rgba(31, 118, 189, 0.18)", + "full": false, + "lineColor": "rgb(31, 120, 193)", + "show": false, + "ymax": null, + "ymin": null + }, + "tableColumn": "oe_sync_status{instance=\"localhost:8545\", job=\"openethereum\"}", + "targets": [ + { + "expr": "oe_sync_status", + "refId": "A" + } + ], + "thresholds": "", + "timeFrom": null, + "timeShift": null, + "title": "Sync status", + "type": "singlestat", + "valueFontSize": "80%", + "valueMaps": [ + { + "op": "=", + "text": "WaitingPeers", + "value": "0" + }, + { + "op": "=", + "text": "Waiting", + "value": "6" + }, + { + "op": "=", + "text": "SnapshotManifest", + "value": "1" + }, + { + "op": "=", + "text": "SnapshotData", + "value": "2" + }, + { + "op": "=", + "text": "SnapshotWaiting", + "value": "3" + }, + { + "op": "=", + "text": "Blocks", + "value": "4" + }, + { + "op": "=", + "text": "Idle", + "value": "5" + }, + { + "op": "=", + "text": "NewBlocks", + "value": "7" + } + ], + "valueName": "current" + }, + { + "aliasColors": {}, + "bars": true, + "cacheTimeout": null, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 3, + "w": 3, + "x": 9, + "y": 0 + }, + "hiddenSeries": false, + "id": 28, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": false, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "oe_metrics_time", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "RPC Metrics Reponse time", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": false, + "values": [] + }, + "yaxes": [ + { + "format": "ms", + "label": null, + "logBase": 1, + "max": "1000", + "min": "0", + "show": false + }, + { + "decimals": null, + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": false + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 4, + "w": 4, + "x": 12, + "y": 0 + }, + "hiddenSeries": false, + "id": 8, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "rate(oe_import_blocks[1m])", + "interval": "", + "legendFormat": "", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Block/s", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": false, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 4, + "w": 4, + "x": 16, + "y": 0 + }, + "hiddenSeries": false, + "id": 6, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "rate(oe_import_gas[1m])/1000000", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "MGas/s", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": false, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 4, + "w": 4, + "x": 20, + "y": 0 + }, + "hiddenSeries": false, + "id": 10, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "rate(oe_import_txs[1m])", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Tx/s", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": false, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 5, + "w": 12, + "x": 0, + "y": 3 + }, + "hiddenSeries": false, + "id": 16, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pluginVersion": "6.5.2", + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "oe_net_peers", + "refId": "A" + }, + { + "expr": "oe_net_active_peers", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Peers", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": false, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 4, + "w": 6, + "x": 12, + "y": 4 + }, + "hiddenSeries": false, + "id": 12, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "rate(oe_io_bytes_read[1m])", + "interval": "", + "legendFormat": "", + "refId": "A" + }, + { + "expr": "rate(oe_io_bytes_written[1m])", + "interval": "", + "legendFormat": "", + "refId": "B" + }, + { + "expr": "rate(oe_io_cache_read_bytes[1m])/60", + "refId": "C" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "DB IO", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": false, + "values": [] + }, + "yaxes": [ + { + "decimals": null, + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 4, + "w": 6, + "x": 18, + "y": 4 + }, + "hiddenSeries": false, + "id": 14, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": true, + "steppedLine": false, + "targets": [ + { + "expr": "oe_queue_size_unverified", + "refId": "A" + }, + { + "expr": "oe_queue_size_verified", + "refId": "B" + }, + { + "expr": "oe_queue_size_verifying", + "refId": "C" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Queue", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": false, + "values": [] + }, + "yaxes": [ + { + "decimals": 0, + "format": "short", + "label": "", + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "decimals": 0, + "format": "short", + "label": "", + "logBase": 1, + "max": null, + "min": "0", + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 4, + "w": 3, + "x": 0, + "y": 8 + }, + "hiddenSeries": false, + "id": 4, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [ + {} + ], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "oe_snapshot_download_chunks - oe_snapshot_download_chunks_done", + "legendFormat": "Pending blocks", + "refId": "A" + }, + { + "expr": "rate(oe_snapshot_download_chunks_done[5m])*3600", + "legendFormat": "Rate per hour", + "refId": "B" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Pending Snapshot download", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": false, + "values": [] + }, + "yaxes": [ + { + "decimals": 0, + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "decimals": 0, + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 4, + "w": 3, + "x": 3, + "y": 8 + }, + "hiddenSeries": false, + "id": 27, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "oe_snapshot_restore_block", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Snapshot restore", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": false, + "values": [] + }, + "yaxes": [ + { + "decimals": 0, + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "decimals": 0, + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 4, + "w": 3, + "x": 6, + "y": 8 + }, + "hiddenSeries": false, + "id": 31, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "oe_chain_block - oe_chain_warpsync_gap_last", + "interval": "", + "legendFormat": "", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Snapshot GAP", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": false, + "values": [] + }, + "yaxes": [ + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 4, + "w": 3, + "x": 9, + "y": 8 + }, + "hiddenSeries": false, + "id": 26, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": false, + "steppedLine": false, + "targets": [ + { + "expr": "oe_snapshot_create_block", + "refId": "A" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Snapshot create", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": false, + "values": [] + }, + "yaxes": [ + { + "decimals": 0, + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "decimals": 0, + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "cacheTimeout": null, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 4, + "w": 6, + "x": 12, + "y": 8 + }, + "hiddenSeries": false, + "id": 22, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "links": [], + "nullPointMode": "null", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": true, + "steppedLine": false, + "targets": [ + { + "expr": "oe_blockchaincache_block_details", + "refId": "A" + }, + { + "expr": "oe_blockchaincache_block_recipts", + "refId": "B" + }, + { + "expr": "oe_blockchaincache_blocks", + "refId": "C" + }, + { + "expr": "oe_blockchaincache_txaddrs", + "refId": "D" + }, + { + "expr": "", + "refId": "E" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Blockchain cache", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": false, + "values": [] + }, + "yaxes": [ + { + "decimals": 0, + "format": "decbytes", + "label": "", + "logBase": 1, + "max": null, + "min": "0", + "show": true + }, + { + "decimals": 0, + "format": "bytes", + "label": null, + "logBase": 1, + "max": null, + "min": "0", + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + }, + { + "aliasColors": {}, + "bars": false, + "dashLength": 10, + "dashes": false, + "datasource": null, + "fieldConfig": { + "defaults": { + "custom": {} + }, + "overrides": [] + }, + "fill": 1, + "fillGradient": 0, + "gridPos": { + "h": 4, + "w": 6, + "x": 18, + "y": 8 + }, + "hiddenSeries": false, + "id": 2, + "legend": { + "avg": false, + "current": false, + "max": false, + "min": false, + "show": false, + "total": false, + "values": false + }, + "lines": true, + "linewidth": 1, + "nullPointMode": "null", + "options": { + "dataLinks": [] + }, + "percentage": false, + "pointradius": 2, + "points": false, + "renderer": "flot", + "seriesOverrides": [], + "spaceLength": 10, + "stack": true, + "steppedLine": false, + "targets": [ + { + "expr": "oe_queue_mem_used", + "refId": "A" + }, + { + "expr": "oe_sync_mem_used", + "refId": "B" + }, + { + "expr": "oe_statedb_mem_used", + "refId": "C" + } + ], + "thresholds": [], + "timeFrom": null, + "timeRegions": [], + "timeShift": null, + "title": "Memory", + "tooltip": { + "shared": true, + "sort": 0, + "value_type": "individual" + }, + "type": "graph", + "xaxis": { + "buckets": null, + "mode": "time", + "name": null, + "show": false, + "values": [] + }, + "yaxes": [ + { + "format": "bytes", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + }, + { + "format": "short", + "label": null, + "logBase": 1, + "max": null, + "min": null, + "show": true + } + ], + "yaxis": { + "align": false, + "alignLevel": null + } + } + ], + "refresh": false, + "schemaVersion": 25, + "style": "dark", + "tags": [], + "templating": { + "list": [] + }, + "time": { + "from": "2020-06-10T16:05:07.848Z", + "to": "2020-06-10T16:08:24.212Z" + }, + "timepicker": { + "refresh_intervals": [ + "10s", + "30s", + "1m", + "5m", + "15m", + "30m", + "1h", + "2h", + "1d" + ] + }, + "timezone": "", + "title": "OpenEthereum", + "uid": "fH2SyJiMz", + "version": 2 + } \ No newline at end of file diff --git a/scripts/prometheus/config/grafana/grafana.ini b/scripts/prometheus/config/grafana/grafana.ini new file mode 100644 index 00000000000..dba20ae99a3 --- /dev/null +++ b/scripts/prometheus/config/grafana/grafana.ini @@ -0,0 +1,705 @@ +##################### Grafana Configuration Defaults ##################### +# +# Do not modify this file in grafana installs +# + +# possible values : production, development +app_mode = production + +# instance name, defaults to HOSTNAME environment variable value or hostname if HOSTNAME var is empty +instance_name = ${HOSTNAME} + +#################################### Paths ############################### +[paths] +# Path to where grafana can store temp files, sessions, and the sqlite3 db (if that is used) +data = data + +# Temporary files in `data` directory older than given duration will be removed +temp_data_lifetime = 24h + +# Directory where grafana can store logs +logs = data/log + +# Directory where grafana will automatically scan and look for plugins +plugins = data/plugins + +# folder that contains provisioning config files that grafana will apply on startup and while running. +provisioning = conf/provisioning + +#################################### Server ############################## +[server] +# Protocol (http, https, h2, socket) +protocol = http + +# The ip address to bind to, empty will bind to all interfaces +http_addr = + +# The http port to use +http_port = 3000 + +# The public facing domain name used to access grafana from a browser +domain = localhost + +# Redirect to correct domain if host header does not match domain +# Prevents DNS rebinding attacks +enforce_domain = false + +# The full public facing url +root_url = %(protocol)s://%(domain)s:%(http_port)s/ + +# Serve Grafana from subpath specified in `root_url` setting. By default it is set to `false` for compatibility reasons. +serve_from_sub_path = false + +# Log web requests +router_logging = false + +# the path relative working path +static_root_path = public + +# enable gzip +enable_gzip = false + +# https certs & key file +cert_file = +cert_key = + +# Unix socket path +socket = /tmp/grafana.sock + +#################################### Database ############################ +[database] +# You can configure the database connection by specifying type, host, name, user and password +# as separate properties or as on string using the url property. + +# Either "mysql", "postgres" or "sqlite3", it's your choice +type = sqlite3 +host = 127.0.0.1:3306 +name = grafana +user = root +# If the password contains # or ; you have to wrap it with triple quotes. Ex """#password;""" +password = +# Use either URL or the previous fields to configure the database +# Example: mysql://user:secret@host:port/database +url = + +# Max idle conn setting default is 2 +max_idle_conn = 2 + +# Max conn setting default is 0 (mean not set) +max_open_conn = + +# Connection Max Lifetime default is 14400 (means 14400 seconds or 4 hours) +conn_max_lifetime = 14400 + +# Set to true to log the sql calls and execution times. +log_queries = + +# For "postgres", use either "disable", "require" or "verify-full" +# For "mysql", use either "true", "false", or "skip-verify". +ssl_mode = disable + +ca_cert_path = +client_key_path = +client_cert_path = +server_cert_name = + +# For "sqlite3" only, path relative to data_path setting +path = grafana.db + +# For "sqlite3" only. cache mode setting used for connecting to the database +cache_mode = private + +#################################### Cache server ############################# +[remote_cache] +# Either "redis", "memcached" or "database" default is "database" +type = database + +# cache connectionstring options +# database: will use Grafana primary database. +# redis: config like redis server e.g. `addr=127.0.0.1:6379,pool_size=100,db=0,ssl=false`. Only addr is required. ssl may be 'true', 'false', or 'insecure'. +# memcache: 127.0.0.1:11211 +connstr = + +#################################### Data proxy ########################### +[dataproxy] + +# This enables data proxy logging, default is false +logging = false + +# How long the data proxy should wait before timing out default is 30 (seconds) +timeout = 30 + +# If enabled and user is not anonymous, data proxy will add X-Grafana-User header with username into the request, default is false. +send_user_header = false + +#################################### Analytics ########################### +[analytics] +# Server reporting, sends usage counters to stats.grafana.org every 24 hours. +# No ip addresses are being tracked, only simple counters to track +# running instances, dashboard and error counts. It is very helpful to us. +# Change this option to false to disable reporting. +reporting_enabled = true + +# Set to false to disable all checks to https://grafana.com +# for new versions (grafana itself and plugins), check is used +# in some UI views to notify that grafana or plugin update exists +# This option does not cause any auto updates, nor send any information +# only a GET request to https://grafana.com to get latest versions +check_for_updates = true + +# Google Analytics universal tracking code, only enabled if you specify an id here +google_analytics_ua_id = + +# Google Tag Manager ID, only enabled if you specify an id here +google_tag_manager_id = + +#################################### Security ############################ +[security] +# disable creation of admin user on first start of grafana +disable_initial_admin_creation = false + +# default admin user, created on startup +admin_user = admin + +# default admin password, can be changed before first start of grafana, or in profile settings +admin_password = admin + +# used for signing +secret_key = SW2YcwTIb9zpOOhoPsMm + +# disable gravatar profile images +disable_gravatar = false + +# data source proxy whitelist (ip_or_domain:port separated by spaces) +data_source_proxy_whitelist = + +# disable protection against brute force login attempts +disable_brute_force_login_protection = false + +# set to true if you host Grafana behind HTTPS. default is false. +cookie_secure = false + +# set cookie SameSite attribute. defaults to `lax`. can be set to "lax", "strict" and "none" +cookie_samesite = lax + +# set to true if you want to allow browsers to render Grafana in a ,