The Monitoring Stack
For a production Paychainly deployment, you need visibility across four layers:
- Application logs (NestJS structured logging)
- Queue health (BullMQ job counts, failure rates)
- Infrastructure health (
/healthendpoint) - Business metrics (payments per hour, sweep success rate)
Structured Logging with Pino
Replace the default NestJS logger with Pino for structured JSON logs:
npm install nestjs-pino pino-http// In your app bootstrap
app.useLogger(new Logger()); // Or configure Pino
Ship logs to Datadog, Grafana Loki, or CloudWatch. Set up alerts on ERROR log rate exceeding baseline.
Health Check Monitoring
The /health endpoint returns DB, RPC, and gas wallet status. Ping it every 60 seconds from an external monitor (Better Uptime, UptimeRobot, or Checkly):
GET /health
→ { "status": "ok", "db": "connected", "rpc": "healthy", "gasWallet": "0.24 BNB" }Queue Depth Alerting
The block-filter queue should never have more than 500 waiting jobs. Paychainly fires a Telegram alert when it does. Also monitor sweep queue — any stuck jobs there mean funds are sitting in deposit addresses.
SLA Targets
| Metric | Target | Alert Threshold |
|---|---|---|
| Deposit detection latency | < 6 seconds | > 30 seconds |
| Webhook delivery | < 10 seconds | > 60 seconds |
| Sweep completion | < 5 minutes | > 30 minutes |
| API response time | < 200ms p95 | > 1000ms p95 |