Skip to content

Open-source status page, incident response and uptime monitoring

2.1 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_7d__v0
        WHERE
            monitorId = {{ String(monitorId, '4433', required=True) }}
            AND time >= toDateTime64(now() - INTERVAL 7 DAY, 3)
            {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %}
        UNION ALL
        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,
            NULL as lastTimestamp  -- no need to query the `lastTimestamp` as not relevant
        FROM mv__grpc_14d__v0
        WHERE
            monitorId = {{ String(monitorId, '4433', required=True) }}
            AND time >= toDateTime64(now() - INTERVAL 14 DAY, 3)
            AND time < toDateTime64(now() - INTERVAL 7 DAY, 3)
            {% if regions %} AND region IN {{ Array(regions, 'String', 'ams,fra') }} {% end %}


TYPE ENDPOINT