Function prometheus_http_query::functions::round[][src]

pub fn round(vector: InstantVector, to_nearest: Option<f64>) -> InstantVector
Expand description

Apply the PromQL round function.

use prometheus_http_query::{Selector, InstantVector};
use prometheus_http_query::functions::round;
use std::convert::TryInto;

fn main() -> Result<(), prometheus_http_query::Error> {
    let vector: InstantVector = Selector::new()
        .metric("some_metric")?
        .with("some_label", "some_value")
        .try_into()?;

    let result = round(vector, None);

    assert_eq!(&result.to_string(), "round(some_metric{some_label=\"some_value\"})");

    Ok(())
}