Openstatus
www.openstatus.dev
1TAGS "http"
2
3NODE endpoint
4SQL >
5
6 %
7 SELECT
8 round(quantile(0.50)(latency)) as p50Latency,
9 round(quantile(0.75)(latency)) as p75Latency,
10 round(quantile(0.90)(latency)) as p90Latency,
11 round(quantile(0.95)(latency)) as p95Latency,
12 round(quantile(0.99)(latency)) as p99Latency,
13 count() as count,
14 countIf(requestStatus = 'success') AS success,
15 countIf(requestStatus = 'degraded') AS degraded,
16 countIf(requestStatus = 'error') AS error,
17 max(cronTimestamp) AS lastTimestamp
18 FROM mv__http_14d__v1
19 WHERE
20 monitorId = {{ String(monitorId, '1', required=True) }}
21 AND time >= toDateTime64(now() - INTERVAL 14 DAY, 3)
22 {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %}
23 UNION ALL
24 SELECT
25 round(quantile(0.50)(latency)) AS p50Latency,
26 round(quantile(0.75)(latency)) AS p75Latency,
27 round(quantile(0.90)(latency)) AS p90Latency,
28 round(quantile(0.95)(latency)) AS p95Latency,
29 round(quantile(0.99)(latency)) AS p99Latency,
30 count() as count,
31 countIf(requestStatus = 'success') AS success,
32 countIf(requestStatus = 'degraded') AS degraded,
33 countIf(requestStatus = 'error') AS error,
34 NULL as lastTimestamp -- no need to query the `lastTimestamp` as not relevant
35 FROM mv__http_30d__v1
36 WHERE
37 monitorId = {{ String(monitorId, '1', required=True) }}
38 AND time >= toDateTime64(now() - INTERVAL 28 DAY, 3)
39 AND time < toDateTime64(now() - INTERVAL 14 DAY, 3)
40 {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %}
41
42TYPE ENDPOINT