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