pub fn target_metadata(host: &str) -> Result<TargetMetadataQueryBuilder, Error>Expand description
Create a TargetMetadataQueryBuilder to apply filters to a target metadata
query before sending it to Prometheus.
This is just a convenience function for one-off requests, see Client::target_metadata.
use prometheus_http_query::target_metadata;
#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<(), anyhow::Error> {
let response = target_metadata("http://localhost:9090")?
.metric("go_goroutines")
.get()
.await;
assert!(response.is_ok());
let response = target_metadata("http://localhost:9090")?
.match_target("{job=\"prometheus\"}")
.get()
.await;
assert!(response.is_ok());
Ok(())
}