pub async fn metric_metadata(
    host: &str,
    metric: Option<&str>,
    limit: Option<usize>
) -> Result<HashMap<String, Vec<MetricMetadata>>, Error>
Expand description

Retrieve metadata about metrics that are currently scraped from targets.

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

use prometheus_http_query::{metric_metadata, Error, Selector};

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

    let response = metric_metadata("http://localhost:9090", Some("go_routines"), None).await;
    assert!(response.is_ok());

    Ok(())
}