Add network state to system.interval telemetry (#1959)

* add network state to system.interval telemetry

* use serde_json

* use unwrap_or_default
This commit is contained in:
Gregory Terzian
2019-03-12 17:17:29 +08:00
committed by Bastian Köcher
parent 0ea90111b4
commit 90cd8a8479
3 changed files with 5 additions and 0 deletions
+1
View File
@@ -3644,6 +3644,7 @@ dependencies = [
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"names 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.38 (registry+https://github.com/rust-lang/crates.io-index)",
"sr-primitives 0.1.0",
"structopt 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
"substrate-client 0.1.0",
+1
View File
@@ -20,6 +20,7 @@ tokio = "0.1.7"
futures = "0.1.17"
fdlimit = "0.1"
exit-future = "0.1"
serde_json = "1.0"
sysinfo = "0.8.0"
panic-handler = { package = "substrate-panic-handler", path = "../../core/panic-handler" }
client = { package = "substrate-client", path = "../../core/client" }
+3
View File
@@ -82,9 +82,12 @@ pub fn start<C>(service: &Service<C>, exit: ::exit_future::Exit, handle: TaskExe
(proc.cpu_usage(), proc.memory())
} else { (0.0, 0) };
let network_state = serde_json::to_string(&network.network_state()).unwrap_or_default();
telemetry!(
SUBSTRATE_INFO;
"system.interval";
"network_state" => network_state,
"status" => format!("{}{}", status, target),
"peers" => num_peers,
"height" => best_number,