Function prometheus_http_query::functions::predict_linear [−][src]
pub fn predict_linear(vector: RangeVector, seconds: f64) -> InstantVector
Expand description
Apply the PromQL predict_linear
function.
use prometheus_http_query::{Selector, RangeVector};
use prometheus_http_query::functions::predict_linear;
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 = predict_linear(vector, 300.0);
assert_eq!(&result.to_string(), "predict_linear(some_metric{some_label=\"some_value\"}[5m], 300)");
Ok(())
}