Function prometheus_http_query::functions::changes
source · [−]pub fn changes(vector: RangeVector) -> InstantVectorExpand description
Apply the PromQL changes function.
use prometheus_http_query::{Selector, RangeVector};
use prometheus_http_query::functions::changes;
use std::convert::TryInto;
fn main() -> Result<(), prometheus_http_query::Error> {
let vector: RangeVector = Selector::new()
.metric("some_metric")?
.with("some_label", "some_value")
.range("5m")?
.try_into()?;
let result = changes(vector);
assert_eq!(&result.to_string(), "changes(some_metric{some_label=\"some_value\"}[5m])");
Ok(())
}