Function prometheus_http_query::functions::holt_winters[][src]

pub fn holt_winters(
    vector: RangeVector,
    sf: f64,
    tf: f64
) -> Result<InstantVector, Error>
Expand description

Apply the PromQL holt_winters function.

use prometheus_http_query::{Selector, RangeVector};
use prometheus_http_query::functions::holt_winters;
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 = holt_winters(vector, 0.5, 0.9)?;

    assert_eq!(&result.to_string(), "holt_winters(some_metric{some_label=\"some_value\"}[5m], 0.5, 0.9)");

    Ok(())
}