feat(monitoring): liveness/readiness probes, SLO alert rules, and monitoring docs - #376
Merged
devIKargi merged 1 commit intoAug 19, 2026
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 insrc/config/metrics.tsand recorded bysrc/metrics/metrics.interceptor.ts, and aGET /metricsendpoint plus a combinedGET /health. This PR closes the remaining gaps in the acceptance criteria.Changes
src/app.controller.ts) — split the single/healthinto 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).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, andTargetDown.monitoring/grafana/stellaiverse-backend-dashboard.json) — request rate, error ratio, latency percentiles, saturation, DB latency, auth failures.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
docs/monitoring.md.Verified locally against the repo's CI checks:
npx tsc --noEmitandnpm run buildboth pass; the alert rules and dashboard were validated as well-formed YAML/JSON.