Trait prometheus_http_query::query::Query[][src]

pub trait Query<T: for<'de> Deserialize<'de>> {
    fn get_query_params(&self) -> Vec<(&str, &str)>;
fn get_query_endpoint(&self) -> &str; #[must_use] fn execute<'life0, 'life1, 'async_trait>(
        &'life0 self,
        client: &'life1 Client
    ) -> Pin<Box<dyn Future<Output = Result<T, Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: Sync + 'async_trait
, { ... } }

Required methods

Loading content...

Provided methods

#[must_use]fn execute<'life0, 'life1, 'async_trait>(
    &'life0 self,
    client: &'life1 Client
) -> Pin<Box<dyn Future<Output = Result<T, Error>> + Send + 'async_trait>> where
    'life0: 'async_trait,
    'life1: 'async_trait,
    Self: Sync + 'async_trait, 
[src]

Execute a query.

use prometheus_http_query::{Client, Query, RangeQuery, InstantQuery};

let client: Client = Default::default();

let query = RangeQuery {
    query: "up",
    start: "2021-04-09T11:30:00.000+02:00",
    end: "2021-04-09T12:30:00.000+02:00",
    step: "5m",
    timeout: None,
};
let response = tokio_test::block_on( async { query.execute(&client).await.unwrap() });
assert!(response.is_success());

let query = InstantQuery {
    query: "up",
    time: None,
    timeout: None,
};
let response = tokio_test::block_on( async { query.execute(&client).await.unwrap() });
assert!(response.is_success());
Loading content...

Implementors

Loading content...