Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
Fix metrics Results handling
Browse files Browse the repository at this point in the history
  • Loading branch information
adria0 committed Jul 18, 2020
1 parent 4014fe1 commit 19b7279
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions parity/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ fn handle_request(req: Request<Body>, state: &Arc<Mutex<State>>) -> Response<Bod
let mut buffer = vec![];
let encoder = prometheus::TextEncoder::new();
let metric_families = reg.gather();
encoder.encode(&metric_families, &mut buffer).unwrap();
let text = String::from_utf8(buffer).unwrap();

encoder.encode(&metric_families, &mut buffer).expect("all source of metrics are static; qed");
let text = String::from_utf8(buffer).expect("metrics encoding is ASCII; qed");

Response::new(Body::from(text))
},
Expand Down Expand Up @@ -102,8 +103,8 @@ pub fn start_prometheus_metrics(conf: &MetricsConfiguration, deps: &rpc::Depende
}))
}
});
let server = Server::bind(&addr).serve(make_service);
let _ =server.await;
Server::bind(&addr).serve(make_service).await
.expect("unable to create prometheus service.");
});

Ok(())
Expand Down

0 comments on commit 19b7279

Please sign in to comment.