fix(store): coalesce NULL avg_latency_ms in HourlyBuckets
This commit is contained in:
1 parent
9b26b4150e
commit
db37060c70
3 files changed
+17
-2
No files matched your search
@@ -200,7 +200,7 @@ func (q *Queries) FirstDataRecent(ctx context.Context, arg FirstDataRecentParams
|
||||
|
||||
const hourlyBuckets = `-- name: HourlyBuckets :many
|
||||
SELECT monitor_id, bucket::timestamptz AS bucket, sum(total)::bigint AS total, sum(ok_count)::bigint AS ok_count,
|
||||
(sum(avg_latency_ms * total) / nullif(sum(total), 0))::real AS avg_latency_ms
|
||||
coalesce(sum(avg_latency_ms * total) / nullif(sum(total), 0), 0)::real AS avg_latency_ms
|
||||
FROM check_results_1h
|
||||
WHERE org_id = $1 AND bucket >= $2
|
||||
GROUP BY monitor_id, bucket
|
||||
|
||||
Reference in new issue
Block a user