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:
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:
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:
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