Add process metrics to http-server

This commit is contained in:
Paul Hauner
2019-05-30 12:36:27 +10:00
parent 4851d8be03
commit f44170cab1
2 changed files with 6 additions and 2 deletions

View File

@@ -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();