Skip to content

Monitoring


Logging — Serilog

All API logs use Serilog structured JSON format, written to stdout. Railway captures stdout and makes it searchable in the Railway dashboard.

Log levels: Information by default, Warning for production. To increase verbosity, set:

Serilog__MinimumLevel=Debug

Key structured properties on every log: RequestId, UserId (when authenticated), TraceId.


Error Tracking — Sentry

Unhandled exceptions and manual SentrySdk.CaptureException() calls are sent to Sentry.

Configure via:

Sentry__Dsn=https://...@sentry.io/...

Leave empty to disable. Sentry is enabled in production and disabled in development.


Metrics — Prometheus

A Prometheus scrape endpoint is exposed at GET /metrics. Metrics include:

  • HTTP request rate, latency histogram, error rate (by route and status code)
  • .NET runtime metrics (GC pressure, thread pool, memory)
  • Custom business metrics added via IMetrics

To scrape locally:

curl http://localhost:5000/metrics

Healthchecks

Endpoint Checks
GET /health Overall health (Healthy / Degraded / Unhealthy)
GET /health/ready Postgres connection
GET /health/live Always 200 (liveness probe for Railway)

Railway uses /health/live as the liveness probe. Deployments wait for a healthy response before switching traffic.


Railway Dashboard

Railway provides: - Live log streaming - Deployment history with rollback - Environment variable management - Automatic HTTPS + custom domain support