Skip to content

Open-source status page, incident response and uptime monitoring

1.0 KB
Raw Blame
TOKEN "endpoint__dns_uptime_30d__v1_endpoint_read_4617" READ

NODE endpoint
SQL >

%
SELECT
    toStartOfInterval(
        toDateTime(timestamp / 1000), INTERVAL {{ String(interval, '30', required=True) }} minute
    ) AS interval,
    countIf(requestStatus = 'success') AS success,
    countIf(requestStatus = 'degraded') AS degraded,
    countIf(requestStatus = 'error') AS error
FROM dns_response__v0
WHERE
    monitorId = {{ String(monitorId, '7417', required=True) }}
    -- dns_response__v0 has no TTL; cap the window like the TTL-bound http/tcp uptime MVs
    AND toDateTime(timestamp / 1000) >= now() - INTERVAL 30 DAY
    {% if defined(fromDate) %}
        AND toDateTime(timestamp / 1000) >= parseDateTimeBestEffortOrNull({{ String(fromDate) }})
    {% end %}
    {% if defined(toDate) %}
        AND toDateTime(timestamp / 1000) <= parseDateTimeBestEffortOrNull({{ String(toDate) }})
    {% end %}
    {% if defined(regions) %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %}
GROUP BY interval
ORDER BY interval DESC

TYPE endpoint