Skip to content
Snippets Groups Projects
Commit 8b633ead authored by Maaz Ahmed's avatar Maaz Ahmed
Browse files

fix: quantile_over_time should take additional phi argument

parent db5d8b24
No related branches found
No related tags found
1 merge request!7Resolve "Feat: initial support for functions in the query builder API"
......@@ -44,12 +44,13 @@ pub fn count_over_time(
basic_fn("count_over_time", range_vec)
}
/// The quantile_over_time rollup query function
/// The quantile_over_time rollup query function (phi value must be >= 0 and <= 1)
#[inline]
pub fn quantile_over_time(
phi: f32,
range_vec: impl Operable + 'static,
) -> QryFunc<impl Fn(&mut fmt::Formatter) -> fmt::Result> {
basic_fn("quantile_over_time", range_vec)
QryFunc::new(move |f| write!(f, "quantile_over_time({phi},{range_vec})"))
}
/// The stddev_over_time rollup query function
......@@ -124,8 +125,8 @@ mod tests {
#[test]
fn rollup_quantile() {
let string = quantile_over_time(test_metric()).to_string();
assert_eq!(string, "quantile_over_time(test_metric[15d])");
let string = quantile_over_time(0.1, test_metric()).to_string();
assert_eq!(string, "quantile_over_time(0.1,test_metric[15d])");
}
#[test]
fn rollup_stddev() {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment