pub fn metric_metadata(host: &str) -> Result<MetricMetadataQueryBuilder, Error>
Expand description

Create a MetricMetadataQueryBuilder to apply filters to a metric metadata query before sending it to Prometheus.

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

use prometheus_http_query::{metric_metadata, Selector};

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

    let response = metric_metadata("http://localhost:9090")?
        .metric("go_goroutines")
        .get()
        .await;
    assert!(response.is_ok());

    Ok(())
}