TAGS "http" NODE endpoint SQL > % SELECT round(quantile(0.50)(latency)) as p50Latency, round(quantile(0.75)(latency)) as p75Latency, round(quantile(0.90)(latency)) as p90Latency, round(quantile(0.95)(latency)) as p95Latency, round(quantile(0.99)(latency)) as p99Latency, count() as count, countIf(requestStatus = 'success') AS success, countIf(requestStatus = 'degraded') AS degraded, countIf(requestStatus = 'error') AS error, max(cronTimestamp) AS lastTimestamp FROM mv__http_7d__v1 WHERE monitorId = {{ String(monitorId, '1', required=True) }} AND time >= toDateTime64(now() - INTERVAL 7 DAY, 3) {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} UNION ALL SELECT round(quantile(0.50)(latency)) AS p50Latency, round(quantile(0.75)(latency)) AS p75Latency, round(quantile(0.90)(latency)) AS p90Latency, round(quantile(0.95)(latency)) AS p95Latency, round(quantile(0.99)(latency)) AS p99Latency, count() as count, countIf(requestStatus = 'success') AS success, countIf(requestStatus = 'degraded') AS degraded, countIf(requestStatus = 'error') AS error, NULL as lastTimestamp -- no need to query the `lastTimestamp` as not relevant FROM mv__http_14d__v1 WHERE monitorId = {{ String(monitorId, '1', required=True) }} AND time >= toDateTime64(now() - INTERVAL 14 DAY, 3) AND time < toDateTime64(now() - INTERVAL 7 DAY, 3) {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %} TYPE ENDPOINT