From d3b6a73f7b920c9dafebc22fcb85888426cc3cdf Mon Sep 17 00:00:00 2001 From: teor Date: Wed, 2 Sep 2020 11:20:32 +1000 Subject: [PATCH] Improve zebra-state logging and metrics --- Cargo.lock | 1 + zebra-state/Cargo.toml | 1 + zebra-state/src/on_disk.rs | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index 0994ac28..61afb972 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3212,6 +3212,7 @@ dependencies = [ "futures", "hex", "lazy_static", + "metrics", "once_cell", "serde", "sled", diff --git a/zebra-state/Cargo.toml b/zebra-state/Cargo.toml index 23d8e388..51d74549 100644 --- a/zebra-state/Cargo.toml +++ b/zebra-state/Cargo.toml @@ -18,6 +18,7 @@ serde = { version = "1", features = ["serde_derive"] } sled = "0.34.3" futures = "0.3.5" +metrics = "0.12" tower = "0.3.1" tracing = "0.1" tracing-error = "0.1.2" diff --git a/zebra-state/src/on_disk.rs b/zebra-state/src/on_disk.rs index 3e3ebaf9..e1ac5a35 100644 --- a/zebra-state/src/on_disk.rs +++ b/zebra-state/src/on_disk.rs @@ -57,6 +57,10 @@ impl SledState { Ok(()) })?; + tracing::trace!(?height, ?hash, "Committed block"); + metrics::gauge!("state.committed.block.height", height.0 as _); + metrics::counter!("state.committed.block.count", 1); + Ok(hash) }