commit 0408b73e647a0207f6b6db486d46f1c9993323b6 Author: Karsten Loesing karsten.loesing@gmx.net Date: Mon Oct 22 09:42:41 2018 +0200
Handle days without any successful measurements.
In the past, there have been days without a single OnionPerf successful measurement to onion services. Despite the fact that we seriously need better monitoring, we also need to treat these results correctly. So far, we'd have computed median and quartile values of 0.0 seconds for these cases, which is just wrong. We need to treat these days as missing values when it comes to medians or quartiles. That's what we're fixing here.
Fixes #28136. --- src/main/sql/onionperf/init-onionperf.sql | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/main/sql/onionperf/init-onionperf.sql b/src/main/sql/onionperf/init-onionperf.sql index fad6bef..49eff4a 100644 --- a/src/main/sql/onionperf/init-onionperf.sql +++ b/src/main/sql/onionperf/init-onionperf.sql @@ -58,9 +58,9 @@ SELECT date, filesize, source, server, - q[1] AS q1, - q[2] AS md, - q[3] AS q3, + CASE WHEN q IS NULL THEN NULL ELSE q[1] END AS q1, + CASE WHEN q IS NULL THEN NULL ELSE q[2] END AS md, + CASE WHEN q IS NULL THEN NULL ELSE q[3] END AS q3, timeouts, failures, requests @@ -70,7 +70,9 @@ SELECT DATE(start) AS date, source, CASE WHEN endpointremote LIKE '%.onion%' THEN 'onion' ELSE 'public' END AS server, - PERCENTILE_CONT(ARRAY[0.25,0.5,0.75]) WITHIN GROUP(ORDER BY datacomplete) AS q, + CASE WHEN COUNT(*) > 0 THEN + PERCENTILE_CONT(ARRAY[0.25,0.5,0.75]) WITHIN GROUP(ORDER BY datacomplete) + ELSE NULL END AS q, COUNT(CASE WHEN didtimeout OR datacomplete < 1 THEN 1 ELSE NULL END) AS timeouts, COUNT(CASE WHEN NOT didtimeout AND datacomplete >= 1 @@ -85,7 +87,9 @@ SELECT DATE(start) AS date, '' AS source, CASE WHEN endpointremote LIKE '%.onion%' THEN 'onion' ELSE 'public' END AS server, - PERCENTILE_CONT(ARRAY[0.25,0.5,0.75]) WITHIN GROUP(ORDER BY datacomplete) AS q, + CASE WHEN COUNT(*) > 0 THEN + PERCENTILE_CONT(ARRAY[0.25,0.5,0.75]) WITHIN GROUP(ORDER BY datacomplete) + ELSE NULL END AS q, COUNT(CASE WHEN didtimeout OR datacomplete < 1 THEN 1 ELSE NULL END) AS timeouts, COUNT(CASE WHEN NOT didtimeout AND datacomplete >= 1
tor-commits@lists.torproject.org