Skip to main content

targets

Function targets 

Source
pub fn targets(host: &str) -> Result<TargetsQueryBuilder, Error>
Expand description

Query the current state of target discovery.

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

use prometheus_http_query::{targets, TargetState};

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

    assert!(response.is_ok());

    Ok(())
}