Function prometheus_http_query::functions::round
source · [−]pub fn round(vector: InstantVector, to_nearest: Option<f64>) -> InstantVectorExpand 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(())
}