Skip to content

feat(monitoring): liveness/readiness probes, SLO alert rules, and monitoring docs - #376

Merged
devIKargi merged 1 commit into
StellAIverse:mainfrom
zakariyaufarida5-wq:feat/367-liveness-readiness-monitoring
Aug 19, 2026
Merged

feat(monitoring): liveness/readiness probes, SLO alert rules, and monitoring docs#376
devIKargi merged 1 commit into
StellAIverse:mainfrom
zakariyaufarida5-wq:feat/367-liveness-readiness-monitoring

Conversation

@zakariyaufarida5-wq

Copy link
Copy Markdown
Contributor

Closes #367

Summary

The backend already had most of the logging & monitoring stack — structured JSON logs via the pino logger (src/config/nest-pino-logger.ts) with request/response logging middleware, Prometheus metrics defined in src/config/metrics.ts and recorded by src/metrics/metrics.interceptor.ts, and a GET /metrics endpoint plus a combined GET /health. This PR closes the remaining gaps in the acceptance criteria.

Changes

  • Liveness & readiness probes (src/app.controller.ts) — split the single /health into orchestrator-grade probes:
    • GET /health/live — liveness; performs no dependency checks, so a transient downstream outage doesn't cause a pod restart.
    • GET /health/ready — readiness; verifies critical dependencies, so the orchestrator routes traffic only when the service is actually ready.
      Both are @Public() and un-rate-limited (probes run frequently).
  • Prometheus SLO/SLI alert rules (monitoring/prometheus/alerts.yml) over the real exported metrics: error-rate (>5%), p95 request latency (>1s), p95 DB latency (>500ms), in-flight saturation, event-loop lag, auth-failure spikes, and TargetDown.
  • Grafana dashboard (monitoring/grafana/stellaiverse-backend-dashboard.json) — request rate, error ratio, latency percentiles, saturation, DB latency, auth failures.
  • Documentation (docs/monitoring.md) — log field format, full metrics table, health-endpoint usage (with example K8s probe config), and the alerting thresholds/SLOs.

Acceptance criteria mapping

  • Structured JSON logs (requestId/userId/timestamp/severity) — already present; documented in docs/monitoring.md.
  • Metrics (latency, error rates, saturation) + Prometheus endpoint — already present; documented.
  • Health-check endpoints for liveness and readiness — added here.
  • Dashboards and example SLO/SLI alert rules — added here.
  • Documentation for logging format, metrics list, and alerting thresholds — added here.

Verified locally against the repo's CI checks: npx tsc --noEmit and npm run build both pass; the alert rules and dashboard were validated as well-formed YAML/JSON.

…itoring docs (StellAIverse#367)

The service already emits structured JSON logs (pino), records Prometheus
metrics, and exposes GET /metrics and a combined GET /health. This completes
the remaining monitoring gaps:

- Split health into orchestrator-grade probes: GET /health/live (liveness, no
  dependency checks) and GET /health/ready (readiness, checks critical
  dependencies), so Kubernetes can restart vs. gate traffic correctly.
- Add Prometheus SLO/SLI alert rules (monitoring/prometheus/alerts.yml) over the
  exported metrics: error-rate, p95 latency, DB latency, saturation, event-loop
  lag, auth-failure spikes, and target-down.
- Add a Grafana overview dashboard (monitoring/grafana/).
- Document the log format, metric list, health endpoints, and alert thresholds
  in docs/monitoring.md.
@devIKargi
devIKargi merged commit b383312 into StellAIverse:main Aug 19, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Logging & Monitoring module: structured logs, metrics, and health checks

2 participants