From 8b633eadecbba410518a6c269c0d1aec121b5a6d Mon Sep 17 00:00:00 2001
From: Maaz Ahmed <maaz.a@subcom.tech>
Date: Fri, 22 Dec 2023 17:00:44 +0530
Subject: [PATCH] fix: quantile_over_time should take additional phi argument

---
 src/query/fns/rollup.rs | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/query/fns/rollup.rs b/src/query/fns/rollup.rs
index 63b5d6e..934e243 100644
--- a/src/query/fns/rollup.rs
+++ b/src/query/fns/rollup.rs
@@ -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() {
-- 
GitLab