pub async fn targets(
    host: &str,
    state: Option<TargetState>
) -> Result<Targets, 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", Some(TargetState::Active)).await;

    assert!(response.is_ok());

    Ok(())
}