Skip to content

Commit

Permalink
Avoid excessive syscall count for prometheus stats serving
Browse files Browse the repository at this point in the history
  • Loading branch information
vi committed May 17, 2022
1 parent ff9176a commit cebc274
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/prometheus_peer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ pub fn serve(psa: SocketAddr) -> crate::Result<()> {

std::thread::spawn(move || {
for s in tcp.incoming() {
if let Ok(mut s) = s {
if let Ok(s) = s {
let mut s = std::io::BufWriter::new(s);
let stats = prometheus::default_registry().gather();
let header = get_static_file_reply(None, "text/plain; version=0.0.4");
let _ = s.write_all(&header[..]);
Expand Down

0 comments on commit cebc274

Please sign in to comment.