Skip to content

Commit adc7caa

Browse files
committed
Merge branch 'staging'
2 parents 7ada0df + 0a70e6c commit adc7caa

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

apps/api/src/query/builders/uptime.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import type { Filter, SimpleQueryConfig } from "../types";
88
* - site_id: Website identifier
99
* - url: Monitored URL
1010
* - timestamp: Check timestamp
11-
* - status: 1 = up, 0 = down, 2 = pending
11+
* - status: 1 = up, 0 = down, 2 = pending (retry logic - excluded from uptime)
1212
* - http_code: HTTP response code
1313
* - ttfb_ms: Time to first byte (ms)
1414
* - total_ms: Total response time (ms)
@@ -27,6 +27,7 @@ export const UptimeBuilders: Record<string, SimpleQueryConfig> = {
2727
COUNT(*) as total_checks,
2828
countIf(status = 1) as successful_checks,
2929
countIf(status = 0) as failed_checks,
30+
countIf(status = 2) as pending_checks,
3031
if((countIf(status = 1) + countIf(status = 0)) = 0, 0, round((countIf(status = 1) / (countIf(status = 1) + countIf(status = 0))) * 100, 2)) as uptime_percentage,
3132
avg(total_ms) as avg_response_time,
3233
quantile(0.50)(total_ms) as p50_response_time,
@@ -75,6 +76,7 @@ export const UptimeBuilders: Record<string, SimpleQueryConfig> = {
7576
COUNT(*) as total_checks,
7677
countIf(status = 1) as successful_checks,
7778
countIf(status = 0) as failed_checks,
79+
countIf(status = 2) as pending_checks,
7880
if((countIf(status = 1) + countIf(status = 0)) = 0, 0, round((countIf(status = 1) / (countIf(status = 1) + countIf(status = 0))) * 100, 2)) as uptime_percentage,
7981
avg(total_ms) as avg_response_time,
8082
quantile(0.50)(total_ms) as p50_response_time,
@@ -232,6 +234,7 @@ export const UptimeBuilders: Record<string, SimpleQueryConfig> = {
232234
COUNT(*) as total_checks,
233235
countIf(status = 1) as successful_checks,
234236
countIf(status = 0) as failed_checks,
237+
countIf(status = 2) as pending_checks,
235238
if((countIf(status = 1) + countIf(status = 0)) = 0, 0, round((countIf(status = 1) / (countIf(status = 1) + countIf(status = 0))) * 100, 2)) as uptime_percentage,
236239
avg(total_ms) as avg_response_time,
237240
quantile(0.95)(total_ms) as p95_response_time

0 commit comments

Comments
 (0)