// This is a minimal, single-threaded, and incorrect HTTP server
// which answers on all requests with prometheus metrics.
This is a minimal, single-threaded, and incorrect HTTP server
which answers on all requests with prometheus metrics.
This is a minimal single - threaded and incorrect HTTP server which answers on all requests with prometheus metrics .
pub fn start_http_server(prometheus_address: &str) -> Result<(), io::Error> {
    let listener = TcpListener::bind(prometheus_address)?;
    log::info!(
        target: LOG_TARGET,
        "Started Prometheus Metric Server. Listening on {}.",
        prometheus_address
    );
    thread::spawn(move || {
        for incoming_request in listener.incoming() {
            let stream = match incoming_request {
                Ok(s) => s,
                Err(e) => {
                    log::error!(
                        target: LOG_TARGET,
                        "Could not process incomming request {}.",
                        e
                    );
                    continue;
                }
            };
            if let Err(e) = handle_request(stream) {
                log::error!(target: LOG_TARGET, "Could not handle request {}.", e);
                continue;
            };
        }
    });
    Ok(())
}
pub fn start_http_server ( prometheus_address : & str ) -> Result < ( ) , io :: Error > { let listener = TcpListener :: bind ( prometheus_address ) ? ; log :: info ! ( target LOG_TARGET " " prometheus_address ) ; thread :: spawn ( move | | { for incoming_request in listener . incoming ( ) { let stream = match incoming_request { Ok ( s ) => s , Err ( e ) => { log :: error ! ( target LOG_TARGET " " e ) ; continue ; } } ; if let Err ( e ) = handle_request ( stream ) { log :: error ! ( target LOG_TARGET " " e ) ; continue ; } ; } } ) ; Ok ( ( ) ) }
This is a minimal, single-threaded, and incorrect HTTP server
which answers on all requests with prometheus metrics.
This is a minimal single - threaded and incorrect HTTP server which answers on all requests with prometheus metrics .
prometheus_address
&str