Payment Gateway Sign in

Monitoring and alerts

Endpoints

  • GET /health: liveness, always cheap.
  • GET /ready: readiness, checks the database.
  • GET /metrics: Prometheus text. Send Authorization: Bearer with the admin token or METRICS_TOKEN.
  • GET /status: operator status as JSON, or HTML with Accept: text/html, with the admin token. Shows the version, uptime, database state, the lease holder and the webhook backlog.

Logs are one JSON object per line with ts, level, msg, request_id and tenant_id. Send x-request-id and it is echoed back. Secrets are redacted and webhook bodies are never logged.

Metrics

gateway_http_requests_total, gateway_http_request_duration_seconds, gateway_settlements_total, gateway_settlement_duration_seconds, gateway_webhook_deliveries_total{outcome}, gateway_webhook_pending, gateway_webhook_oldest_pending_age_seconds, gateway_provider_calls_total{method,op,outcome}, gateway_provider_call_duration_seconds, gateway_watcher_up{provider}, gateway_leader and gateway_db_pool_connections{state}.

Suggested alerts

AlertConditionWhy
No leadersum(gateway_leader) == 0 for 2 minutesNothing settles or delivers without the worker lease.
Two leaderssum(gateway_leader) > 1 for 2 minutesLease problem, check the database clock.
Watcher downgateway_watcher_up == 0 for 5 minutesA provider's settlement stream is not running.
Webhook backloggateway_webhook_oldest_pending_age_seconds > 900Customers are not being told about payments.
Provider errorsrising gateway_provider_calls_total{outcome="error"}A provider or credential is failing.
Not ready/ready failing for 1 minuteDatabase unreachable.
Pool exhaustedgateway_db_pool_connections{state="idle"} == 0 for 5 minutesRaise DB_MAX_CONNECTIONS or find the slow query.

Check the exact label values on your own /metrics output before pasting these into a rule file.