Function prometheus_http_query::aggregations::max [−][src]
pub fn max<'a>(
vector: InstantVector,
labels: Option<Aggregate<'a>>
) -> InstantVector
Expand description
Use the max
aggregation operator on an instant vector.
use prometheus_http_query::{Selector, InstantVector, Aggregate}; use prometheus_http_query::aggregations::max; use std::convert::TryInto; fn main() -> Result<(), prometheus_http_query::Error> { let vector: InstantVector = Selector::new() .metric("node_cpu_seconds_total")? .try_into()?; let result = max(vector, Some(Aggregate::By(&["cpu"]))); assert_eq!(result.to_string(), String::from("max by (cpu) (node_cpu_seconds_total)")); Ok(()) }