Fix pay metrics status aggregation

This commit is contained in:
Codex
2026-07-01 18:52:02 +03:00
parent 6c5493e3e4
commit 910c046089

View File

@@ -129,7 +129,7 @@ async def _business_metrics() -> list[str]:
lines.append(_sample(f"{metric_prefix}_created_total", created, {"service": SERVICE_NAME, "window": window_name})) lines.append(_sample(f"{metric_prefix}_created_total", created, {"service": SERVICE_NAME, "window": window_name}))
paid_total = await _count(select(func.count()).select_from(Payment).where(Payment.paid_at.is_not(None))) paid_total = await _count(select(func.count()).select_from(Payment).where(Payment.paid_at.is_not(None)))
failed_total = await _count(select(func.count()).select_from(Payment).where(Payment.status.in_(["failed", "cancelled", "expired"]))) failed_total = await _count(select(func.count()).select_from(Payment).where(Payment.status.in_(["web3_hash_error", "web3_balance_problem", "receipt_error"])))
lines.append(_sample("payments_succeeded_total", paid_total, {"service": SERVICE_NAME})) lines.append(_sample("payments_succeeded_total", paid_total, {"service": SERVICE_NAME}))
lines.append(_sample("payments_failed_total", failed_total, {"service": SERVICE_NAME})) lines.append(_sample("payments_failed_total", failed_total, {"service": SERVICE_NAME}))
return lines return lines