// Code generated by sqlc. DO NOT EDIT. // versions: // sqlc v1.29.0 // source: outbox.sql package integration import ( "context" ) const countOutboxByStatus = `-- name: CountOutboxByStatus :one SELECT COUNT(*) FILTER (WHERE status = 'pending') AS pending_count, COUNT(*) FILTER (WHERE status = 'failed') AS failed_count, COUNT(*) FILTER (WHERE status = 'dead_letter') AS dead_letter_count FROM core.outbox ` type CountOutboxByStatusRow struct { PendingCount int64 `json:"pending_count"` FailedCount int64 `json:"failed_count"` DeadLetterCount int64 `json:"dead_letter_count"` } // Operator overview "System" panel: the health of the integration delivery // queue in one round trip. // // The three buckets mean different things to an operator and are therefore // reported separately rather than summed: // // pending — enqueued, not yet attempted or waiting on next_attempt_at. // A steady non-zero value is normal. // failed — attempted and errored, still inside max_attempts, so the // poller will retry. In-flight, not lost. // dead_letter — exhausted its retries. Nothing will move this without an // operator, so it is the only bucket that warrants an alarm. // // Enqueue-side writes go through integration.Enqueue (internal/integration/ // outbox.go); this is a read-only health probe over the same table. func (q *Queries) CountOutboxByStatus(ctx context.Context) (CountOutboxByStatusRow, error) { row := q.db.QueryRowContext(ctx, countOutboxByStatus) var i CountOutboxByStatusRow err := row.Scan(&i.PendingCount, &i.FailedCount, &i.DeadLetterCount) return i, err }