Skip to content

Commit 3b62fbd

Browse files
haasonsaasclaude
andcommitted
fix: align PG backend error_rate with JSON backend
Both backends now count only explicit review.failed events as failures, not all non-completed events. Fixes inconsistency where PG counted timeouts as failures but JSON did not. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 68cc29b commit 3b62fbd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/server/storage_pg.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ impl StorageBackend for PgStorageBackend {
401401
"SELECT \
402402
COUNT(*), \
403403
COUNT(*) FILTER (WHERE event_type = 'review.completed'), \
404-
COUNT(*) FILTER (WHERE event_type != 'review.completed'), \
404+
COUNT(*) FILTER (WHERE event_type = 'review.failed'), \
405405
COALESCE(SUM(COALESCE(tokens_total, 0)), 0), \
406406
COALESCE(AVG(duration_ms)::FLOAT8, 0), \
407407
(AVG(overall_score) FILTER (WHERE overall_score IS NOT NULL))::FLOAT8 \
@@ -501,7 +501,7 @@ impl StorageBackend for PgStorageBackend {
501501
&format!(
502502
"SELECT created_at::date, \
503503
COUNT(*) FILTER (WHERE event_type = 'review.completed'), \
504-
COUNT(*) FILTER (WHERE event_type != 'review.completed') \
504+
COUNT(*) FILTER (WHERE event_type = 'review.failed') \
505505
FROM review_events {where_clause} GROUP BY created_at::date ORDER BY created_at::date"
506506
)
507507
)

0 commit comments

Comments
 (0)