Skip to main content

is_server_ready

Function is_server_ready 

Source
pub async fn is_server_ready(host: &str) -> Result<bool, Error>
Expand description

Check Prometheus server readiness.

This is just a convenience function for one-off requests, see Client::is_server_ready.

use prometheus_http_query::is_server_ready;

#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), anyhow::Error> {
    let response = is_server_ready("http://localhost:9090").await;

    assert!(response.unwrap_or_default());

    Ok(())
}