Function prometheus_http_query::functions::absent[][src]

pub fn absent(vector: InstantVector) -> InstantVector
Expand description

Apply the PromQL absent function.

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

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

    let result = absent(vector);

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

    Ok(())
}