Skip to content

Open-source status page, incident response and uptime monitoring

1.2 KB
Raw Blame
TOKEN "endpoint__http_metrics_90d__v1_endpoint_read_2698" READ

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_90d__v1
WHERE
    monitorId = {{ String(monitorId, '1', required=True) }}
    AND time >= toDateTime64(now() - INTERVAL 90 DAY, 3)
    {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %}
UNION ALL
-- the previous 90d window (90-180d ago) is past the 90d MV TTL, so there's no
-- real comparison data. emit an empty row to keep the 2-row contract; count 0
-- makes the client suppress the trend badge (NaN).
SELECT
    0 AS p50Latency,
    0 AS p75Latency,
    0 AS p90Latency,
    0 AS p95Latency,
    0 AS p99Latency,
    0 AS count,
    0 AS success,
    0 AS degraded,
    0 AS error,
    NULL AS lastTimestamp

TYPE endpoint