Skip to content

Open-source status page, incident response and uptime monitoring

1.5 KB
Raw Blame
TAGS "grpc"

NODE endpoint
SQL >

    %
        SELECT
            round(quantileIf(0.50)(latency, servingStatus IS NOT NULL)) as p50Latency,
            round(quantileIf(0.75)(latency, servingStatus IS NOT NULL)) as p75Latency,
            round(quantileIf(0.90)(latency, servingStatus IS NOT NULL)) as p90Latency,
            round(quantileIf(0.95)(latency, servingStatus IS NOT NULL)) as p95Latency,
            round(quantileIf(0.99)(latency, servingStatus IS NOT NULL)) 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__grpc_90d__v0
        WHERE
            monitorId = {{ String(monitorId, '4433', 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