Introduce Prometheus metric endpoint replacing Grafana endpoint (#4981)

* Refactor rebase master prometheus_v0.3

* Milestone1: Final Version of v0.3

* no-std or warm compatibility issues, grapana-data -source code reference and correction,applicable

* Cargo.lock paritytech/master rebase

* prometheus networking.rs del, grafana-data-source networking.rs pub edit and note

* chore: reflect various feedback

* Spaces to tabs.

* Replace grafana and tidy

* Add generics

* Add photo back

* Re-fix spaces in primitives/consensus/babe/src/inherents.rs

* Refactor rebase master prometheus_v0.3

* Milestone1: Final Version of v0.3

* no-std or warm compatibility issues, grapana-data -source code reference and correction,applicable

* prometheus networking.rs del, grafana-data-source networking.rs pub edit and note

* chore: reflect various feedback

* Replace grafana and tidy

* Add generics

* Add photo back

* Re-fix spaces in primitives/consensus/babe/src/inherents.rs

* chore: revert this file back to paritytech/master inherents.rs.

* Add newline at EOF

* Tidy

* Use local registry

* fix typo

Co-Authored-By: Max Inden <mail@max-inden.de>

* chore:  Apply review feedback

* endpoint -> exporter

* fix readme

* Remove lazy_static, use ServiceMetrics struct instead

* Switch to using GaugeVecs

* chore: without nightly , edit README

* block_height -> block_height_number

* Switch to a ready_transactions_number gauge

* Update utils/prometheus/src/lib.rs

Co-Authored-By: Max Inden <mail@max-inden.de>

* no-prometheus flag add

* /metrics url Input check

* remove prometheus in Tracing

* remove prometheus in Tracing

* chore: master code rebase edit

* gitlab-check-web-wasm edit code

* From:from and cargo.lock update

* with_prometheus_registry add background_tasks

* utils/prometheus/src/lib.rs: Restructure #[cfg] for wasm without hyper

Given that Hyper is not compatible with WASM targets it needs to be
excluded from WASM builds. Instead of introducing #[cfg] lines
throughout the crate, this patch splits the crate into two: known_os and
unknown_os (WASM).

* utils/prometheus/src/lib.rs: Feature gate known_os module

* client/cli/src/lib.rs: Re-add newline at end of file

Co-authored-by: JeseonLEE <zeroday26@gmail.com>
Co-authored-by: Gavin Wood <github@gavwood.com>
Co-authored-by: Ashley <ashley.ruglys@gmail.com>
Co-authored-by: Hyungsuk Kang <hskang9@gmail.com>
This commit is contained in:
Max Inden
2020-02-19 15:36:24 +01:00
committed by GitHub
parent e417f986be
commit d8230ecf4b
22 changed files with 409 additions and 648 deletions
+98 -49
View File
@@ -446,6 +446,12 @@ dependencies = [
"wasm-bindgen-futures",
]
[[package]]
name = "bs58"
version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c95ee6bba9d950218b6cc910cf62bc9e0a171d0f4537e3627b0f54d08549b188"
[[package]]
name = "bs58"
version = "0.3.0"
@@ -610,7 +616,6 @@ dependencies = [
"js-sys",
"num-integer",
"num-traits",
"serde",
"time",
"wasm-bindgen",
]
@@ -1952,34 +1957,6 @@ dependencies = [
"scroll",
]
[[package]]
name = "grafana-data-source"
version = "0.8.0"
dependencies = [
"async-std",
"chrono",
"derive_more",
"futures-timer 3.0.1",
"futures-util",
"hyper 0.13.2",
"lazy_static",
"log 0.4.8",
"parking_lot 0.10.0",
"serde",
"serde_json",
"tokio 0.2.11",
]
[[package]]
name = "grafana-data-source-test"
version = "2.0.0"
dependencies = [
"futures 0.3.4",
"futures-timer 3.0.1",
"grafana-data-source",
"rand 0.7.3",
]
[[package]]
name = "h2"
version = "0.1.26"
@@ -2687,8 +2664,8 @@ dependencies = [
"libp2p-wasm-ext",
"libp2p-websocket",
"libp2p-yamux",
"parity-multiaddr",
"parity-multihash",
"parity-multiaddr 0.7.2",
"parity-multihash 0.2.3",
"parking_lot 0.10.0",
"pin-project",
"smallvec 1.2.0",
@@ -2702,7 +2679,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3b874594c4b29de1a29f27871feba8e6cd13aa54a8a1e8f8c7cf3dfac5ca287c"
dependencies = [
"asn1_der",
"bs58",
"bs58 0.3.0",
"ed25519-dalek",
"fnv",
"futures 0.3.4",
@@ -2711,8 +2688,8 @@ dependencies = [
"libsecp256k1",
"log 0.4.8",
"multistream-select",
"parity-multiaddr",
"parity-multihash",
"parity-multiaddr 0.7.2",
"parity-multihash 0.2.3",
"parking_lot 0.10.0",
"pin-project",
"prost",
@@ -2723,7 +2700,7 @@ dependencies = [
"sha2",
"smallvec 1.2.0",
"thiserror",
"unsigned-varint",
"unsigned-varint 0.3.0",
"void",
"zeroize 1.1.0",
]
@@ -2798,7 +2775,7 @@ dependencies = [
"rand 0.7.3",
"sha2",
"smallvec 1.2.0",
"unsigned-varint",
"unsigned-varint 0.3.0",
"wasm-timer",
]
@@ -2833,14 +2810,14 @@ dependencies = [
"libp2p-core",
"libp2p-swarm",
"log 0.4.8",
"parity-multihash",
"parity-multihash 0.2.3",
"prost",
"prost-build",
"rand 0.7.3",
"sha2",
"smallvec 1.2.0",
"uint",
"unsigned-varint",
"unsigned-varint 0.3.0",
"void",
"wasm-timer",
]
@@ -2880,7 +2857,7 @@ dependencies = [
"libp2p-core",
"log 0.4.8",
"parking_lot 0.10.0",
"unsigned-varint",
"unsigned-varint 0.3.0",
]
[[package]]
@@ -2933,7 +2910,7 @@ dependencies = [
"prost",
"prost-build",
"rw-stream-sink",
"unsigned-varint",
"unsigned-varint 0.3.0",
"void",
]
@@ -3334,7 +3311,7 @@ dependencies = [
"log 0.4.8",
"smallvec 1.2.0",
"tokio-io",
"unsigned-varint",
"unsigned-varint 0.3.0",
]
[[package]]
@@ -4576,6 +4553,24 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0c276d76c5333b8c2579e02d49a06733a55b8282d2d9b13e8d53b6406bd7e30a"
[[package]]
name = "parity-multiaddr"
version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "045b3c7af871285146300da35b1932bb6e4639b66c7c98e85d06a32cbc4e8fa7"
dependencies = [
"arrayref",
"bs58 0.2.5",
"byteorder 1.3.4",
"bytes 0.4.12",
"data-encoding",
"parity-multihash 0.1.3",
"percent-encoding 1.0.1",
"serde",
"unsigned-varint 0.2.3",
"url 1.7.2",
]
[[package]]
name = "parity-multiaddr"
version = "0.7.2"
@@ -4583,17 +4578,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "26df883298bc3f4e92528b4c5cc9f806b791955b136da3e5e939ed9de0fd958b"
dependencies = [
"arrayref",
"bs58",
"bs58 0.3.0",
"byteorder 1.3.4",
"data-encoding",
"parity-multihash",
"parity-multihash 0.2.3",
"percent-encoding 2.1.0",
"serde",
"static_assertions",
"unsigned-varint",
"unsigned-varint 0.3.0",
"url 2.1.1",
]
[[package]]
name = "parity-multihash"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df3a17dc27848fd99e4f87eb0f8c9baba6ede0a6d555400c850ca45254ef4ce3"
dependencies = [
"blake2",
"bytes 0.4.12",
"rand 0.6.5",
"sha-1",
"sha2",
"sha3",
"unsigned-varint 0.2.3",
]
[[package]]
name = "parity-multihash"
version = "0.2.3"
@@ -4606,7 +4616,7 @@ dependencies = [
"sha-1",
"sha2",
"sha3",
"unsigned-varint",
"unsigned-varint 0.3.0",
]
[[package]]
@@ -4980,6 +4990,33 @@ dependencies = [
"unicode-xid 0.2.0",
]
[[package]]
name = "prometheus"
version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5567486d5778e2c6455b1b90ff1c558f29e751fc018130fa182e15828e728af1"
dependencies = [
"cfg-if",
"fnv",
"lazy_static",
"protobuf",
"quick-error",
"spin",
]
[[package]]
name = "prometheus-exporter"
version = "0.8.0"
dependencies = [
"async-std",
"derive_more",
"futures-util",
"hyper 0.13.2",
"log 0.4.8",
"prometheus",
"tokio 0.2.11",
]
[[package]]
name = "prost"
version = "0.6.1"
@@ -5031,6 +5068,12 @@ dependencies = [
"prost",
]
[[package]]
name = "protobuf"
version = "2.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6686ddd96a8dbe2687b5f2a687b2cfb520854010ec480f2d74c32e7c9873d3c5"
[[package]]
name = "pwasm-utils"
version = "0.12.0"
@@ -5668,6 +5711,7 @@ dependencies = [
"log 0.4.8",
"names",
"parity-util-mem",
"prometheus-exporter",
"regex",
"rpassword",
"sc-client-api",
@@ -6201,7 +6245,7 @@ dependencies = [
"substrate-test-runtime-client",
"tempfile",
"thiserror",
"unsigned-varint",
"unsigned-varint 0.3.0",
"void",
"wasm-timer",
"zeroize 1.1.0",
@@ -6389,13 +6433,13 @@ dependencies = [
"futures 0.3.4",
"futures-diagnose",
"futures-timer 3.0.1",
"grafana-data-source",
"lazy_static",
"log 0.4.8",
"parity-multiaddr",
"parity-multiaddr 0.5.0",
"parity-scale-codec",
"parity-util-mem",
"parking_lot 0.10.0",
"prometheus-exporter",
"sc-chain-spec",
"sc-client",
"sc-client-api",
@@ -6489,7 +6533,6 @@ name = "sc-tracing"
version = "2.0.0"
dependencies = [
"erased-serde",
"grafana-data-source",
"log 0.4.8",
"parking_lot 0.10.0",
"sc-telemetry",
@@ -8496,6 +8539,12 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "826e7639553986605ec5979c7dd957c7895e93eabed50ab2ffa7f6128a75097c"
[[package]]
name = "unsigned-varint"
version = "0.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a7f0023a96687fe169081e8adce3f65e3874426b7886e9234d490af2dc077959"
[[package]]
name = "unsigned-varint"
version = "0.3.0"