Add process metrics to http-server
This commit is contained in:
parent
4851d8be03
commit
f44170cab1
@ -20,7 +20,7 @@ fork_choice = { path = "../../eth2/fork_choice" }
|
||||
grpcio = { version = "0.4", default-features = false, features = ["protobuf-codec"] }
|
||||
persistent = "^0.4"
|
||||
protobuf = "2.0.2"
|
||||
prometheus = "^0.6"
|
||||
prometheus = { version = "^0.6", features = ["process"] }
|
||||
clap = "2.32.0"
|
||||
store = { path = "../store" }
|
||||
dirs = "1.0.3"
|
||||
|
@ -90,9 +90,13 @@ fn handle_metrics<T: BeaconChainTypes + 'static>(req: &mut Request) -> IronResul
|
||||
let validator_count = beacon_chain.head().beacon_state.validator_registry.len();
|
||||
local_metrics.validator_count.set(validator_count as i64);
|
||||
|
||||
// Gather the metrics.
|
||||
let mut buffer = vec![];
|
||||
let encoder = TextEncoder::new();
|
||||
|
||||
// Gather `DEFAULT_REGISTRY` metrics.
|
||||
encoder.encode(&prometheus::gather(), &mut buffer).unwrap();
|
||||
|
||||
// Gather metrics from our registry.
|
||||
let metric_families = r.gather();
|
||||
encoder.encode(&metric_families, &mut buffer).unwrap();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user