Skip to content

R-#32 Monitoring and Alerting for sivel.xyz #32

@vtamara

Description

@vtamara

Context

The /api/health/credentials endpoint already exists and checks Celo and Base contract reachability via nextTokenId. This issue proposes integrating it into a monitoring system and extending it.

Tasks

1. Uptime Monitoring

  • Configure an external uptime monitor (e.g., UptimeRobot, BetterStack, or a cron job on adJ) to call GET /api/health/credentials every 5 minutes.
  • Alert via email/Telegram if either Celo or Base contract becomes unreachable for >2 consecutive checks.
  • The endpoint returns 200 if at least one contract is healthy, 503 if both are down.

2. Database Health

  • Add database connectivity check to /api/health/credentials:
    • Query credential_metadata table (e.g., SELECT COUNT(*))
    • Return db: true/false in the response
  • Add credential_emission table check (verify recent emissions exist)

3. RPC Health

  • Add RPC latency measurement to the health check:
    • Time the nextTokenId call
    • Include celo_rpc_ms and base_rpc_ms in the response

4. Monitoring Dashboard (optional)

  • Simple HTML dashboard at /health showing:
    • Green/red indicators for Celo contract, Base contract, DB, RPC latency
    • Last 10 check results
    • Auto-refresh

5. Alerting on Mint Failures

  • Log mint transaction hashes to credential_emission on success
  • Monitor for gaps in emission (e.g., no new emissions in last 24h for any token type)
  • Alert if a mint transaction reverts (API endpoint could log failures)

6. Contract Event Monitoring

  • Listen for CredentialMinted, CredentialRevoked, CredentialTypeRegistered events
  • Store event logs for audit trail
  • Alert on unexpected CredentialRevoked events

Acceptance Criteria

  • /api/health/credentials returns: { celo, base, db, celo_rpc_ms, base_rpc_ms, timestamp }
  • External monitor checks every 5 min
  • Alert on 2 consecutive failures
  • RPC latency tracked

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions