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