This directory contains observability and SRE monitoring configurations for the OpenSource Scout backend.
Start the backend server in development mode:
cd server
npm run devYou can verify the following endpoints:
- Liveness Check:
http://localhost:5000/live- Returns
200 OKshowing that the Node process is running.
- Returns
- Readiness Check:
http://localhost:5000/ready- Returns
200 OK(READY) if both Database (Prisma) and Cache (Redis) connections are UP. Otherwise returns503 Service Unavailablewith details of failed checks.
- Returns
- Health Check:
http://localhost:5000/health- Returns overall system health (API, DB, Redis, CPU, memory, uptime).
- Prometheus Metrics:
http://localhost:5000/metrics- Serves raw metrics data parsed by
prom-client(e.g.,http_requests_total,github_requests_total,cache_hits_total, garbage collection stats, memory metrics).
- Serves raw metrics data parsed by
To scrape these metrics into Prometheus:
- Download and install Prometheus.
- Add the backend endpoint as a scrape target in your
prometheus.yml:scrape_configs: - job_name: 'opensource-scout-backend' scrape_interval: 5s metrics_path: '/metrics' static_configs: - targets: ['localhost:5000']
- Start Prometheus:
./prometheus --config.file=prometheus.yml
To visualize the metrics:
- Run Grafana locally (default port is
3000). - Go to Connections > Data Sources and add Prometheus as a data source pointing to your Prometheus server (usually
http://localhost:9090). - Go to Dashboards > New > Import.
- Upload or copy-paste the contents of
monitoring/grafana/dashboard.json. - Select the Prometheus data source and click Import.
This dashboard will display:
- HTTP Request Volume (Rate): Rate of request volume split by method and route path.
- HTTP Error Rate (%): Error rate percentage (HTTP status >= 400).
- Average Request Latency (ms): Average request latency.
- Cache Hit Ratio (%): Cache hit vs miss performance from Redis.