Function prometheus_http_query::targets
source · 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, Error, TargetState};
#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), Error> {
let response = targets("http://localhost:9090", Some(TargetState::Active)).await;
assert!(response.is_ok());
Ok(())
}