Skip to content

Open-source status page, incident response and uptime monitoring

1.5 KB
Raw Blame
NODE endpoint
SQL >

%
    SELECT
        round(quantile(0.5)(latency), 0) as p50Latency,
        round(quantile(0.75)(latency), 0) as p75Latency,
        round(quantile(0.9)(latency), 0) as p90Latency,
        round(quantile(0.95)(latency), 0) as p95Latency,
        round(quantile(0.99)(latency), 0) as p99Latency,
        count() as count,
        count(if(error = 0, 1, NULL)) AS ok,
        max(cronTimestamp) AS lastTimestamp
    FROM mv__http_1d__v0
    WHERE
        monitorId = {{ String(monitorId, '1', required=True) }}
        {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %}
        AND time >= toDateTime64(now() - INTERVAL 1 DAY, 3)
    UNION ALL
    SELECT
        round(quantile(0.5)(latency), 0) as p50Latency,
        round(quantile(0.75)(latency), 0) as p75Latency,
        round(quantile(0.9)(latency), 0) as p90Latency,
        round(quantile(0.95)(latency), 0) as p95Latency,
        round(quantile(0.99)(latency), 0) as p99Latency,
        count() as count,
        count(if(error = 0, 1, NULL)) AS ok,
        NULL as lastTimestamp  -- no need to query the `lastTimestamp` as not relevant
    FROM mv__http_7d__v0 -- REMINDER: this will increase the processed data compared to 3d
    WHERE
        monitorId = {{ String(monitorId, '1', required=True) }}
        {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %}
        AND time >= toDateTime64(now() - INTERVAL 2 DAY, 3)
        AND time < toDateTime64(now() - INTERVAL 1 DAY, 3)

TYPE endpoint