trails/apps/journal/app
Ullrich Schäfer 49aadd04a9
Add observability: health endpoints, structured logging, metrics, Grafana stack
Health endpoints:
- /api/health (Journal) and /health (Planner) with DB connectivity check
- Docker healthchecks updated to use app health endpoints

Structured logging:
- Pino with JSON output in production, pretty-print in dev
- Request logging middleware in Planner (method, path, status, duration)
- Replaced console.log/error with structured logger in email and auth flows

Prometheus metrics:
- prom-client with default Node.js metrics + custom histograms/gauges
- /metrics endpoints on both apps
- http_request_duration, planner_active_sessions, brouter_request_duration

Monitoring stack:
- Prometheus, Loki, Grafana containers in docker-compose
- Grafana provisioned with datasources, dashboards, and alert rules
- Caddy access logging (JSON to stdout for Loki)
- grafana.trails.cool with basic auth via Caddy

Dashboards and alerting:
- Overview: request rate, error rate, latency p50/p95/p99
- Planner: active sessions, connected clients, BRouter latency
- Infrastructure: memory, CPU, event loop lag
- Alerts: disk >80%, app down 2min, error rate >5%

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 22:59:44 +01:00
..
components Fix SSR hydration mismatch for dates 2026-03-24 20:22:58 +00:00
lib Add observability: health endpoints, structured logging, metrics, Grafana stack 2026-03-26 22:59:44 +01:00
routes Add observability: health endpoints, structured logging, metrics, Grafana stack 2026-03-26 22:59:44 +01:00
entry.client.tsx Fix i18n: move init to root.tsx and downgrade to stable versions 2026-03-25 23:18:15 +00:00
entry.server.tsx Filter 404s from Sentry on client and server 2026-03-25 08:02:26 +00:00
root.tsx Fix i18n: move init to root.tsx and downgrade to stable versions 2026-03-25 23:18:15 +00:00
routes.ts Add privacy route to journal route config 2026-03-25 03:15:38 +01:00