- deploy/loki/rules/fake/errors_hub_alerts.yaml: four LogQL-based Loki ruler alert rules (error rate per service, fatal detection, ingest-api sustained errors, collector-worker stall detection) - deploy/loki/loki.yaml: add explicit ruler.storage (local), rule_path, and enable_api/enable_alertmanager_v2 so Loki loads rules from /loki/rules - docker-compose.yml: mount deploy/loki/rules → /loki/rules:ro in the loki service (observability profile) - docs/MONITORING.md: add Loki section with label table, alert rule summary, config file index, and LXC deployment note Paperclip-Issue: BIT-19957 Paperclip-Agent: cto
4.0 KiB
Monitoring & observability (errors hub)
Audience: on-call, DevOps, SRE.
Purpose: single entry point in this repository for hub-specific metrics, SLO runbooks, and Grafana artefacts—plus a pointer to the company-wide observability map.
Fleet context (BitReport)
Cross-service metrics, logs, alert routing, and related automation are indexed in the meta-repository:
- MONITORING_INDEX.md (paperclip, BIT-221) — company observability map.
Company standards for signals (logs, metrics, tracing, alerting) are summarized under Observability in docs/environments/04-services-and-ops.md § Observability (same meta-repo).
This service (errors.bitreport.pt)
| Topic | Location |
|---|---|
Prometheus scrape targets (/metrics), labels |
OBSERVABILITY_PROMETHEUS.md |
| SLO targets, example alert rules, Grafana dashboard name | RUNBOOK_SLO.md |
| Grafana dashboard JSON (import into your Grafana) | ../deploy/grafana/error-monitoring-dashboard.json |
Scrape both the hub API and the ingest API; see OBSERVABILITY_PROMETHEUS.md for paths and metric families.
Log aggregation (Loki)
| Topic | Location |
|---|---|
| Architecture, labels, LogQL queries, troubleshooting | OBSERVABILITY_LOKI.md |
| Loki server config (schema, retention, ruler) | ../deploy/loki/loki.yaml |
| Promtail config — Docker Compose lab | ../deploy/loki/promtail.yaml |
| Promtail config — LXC / production | ../deploy/loki/promtail-lxc.yaml |
| Promtail systemd unit (LXC) | ../deploy/loki/systemd/promtail.service |
| Grafana log dashboard | ../deploy/grafana/loki-logs-dashboard.json |
| Loki ruler alert rules | ../deploy/loki/rules/fake/errors_hub_alerts.yaml |
| LXC operational runbook | deployment/loki-lxc-runbook.md |
Labels
Every log line from errors-hub carries these Loki labels:
| Label | Values |
|---|---|
app |
errors-hub (static) |
env |
production (static) |
service |
ingest-api, api, collector-worker, admin-ui, web |
level |
info, warn, error, fatal (normalised from Pino numeric levels) |
Labels are consistent across Docker Compose (Docker SD) and LXC (journald) deployments.
trace and debug lines are dropped by Promtail in both configs.
Starting the observability stack
# Docker Compose (lab) — core services + Loki + Promtail
docker compose --profile observability up -d
# Verify log ingestion
curl -s 'http://localhost:3100/loki/api/v1/labels'
Alert rules (Loki ruler)
Rules live in deploy/loki/rules/fake/errors_hub_alerts.yaml and are evaluated by the Loki ruler component.
| Alert | Condition | Severity |
|---|---|---|
ErrorsHubServiceErrorRateHigh |
Any service >0.1 error lines/s for 5m | warning |
ErrorsHubFatalLogDetected |
Any fatal line in any service for 1m | critical |
ErrorsHubIngestApiHighErrorRate |
ingest-api >0.05 error lines/s for 10m | critical |
ErrorsHubCollectorWorkerStalled |
collector-worker silent for 15m | warning |
Alerts route to Alertmanager (ruler.alertmanager_url in deploy/loki/loki.yaml).
For production LXC: point alertmanager_url to the central Alertmanager (http://<observability-ct>:9093).
For production LXC deployment, copy deploy/loki/rules/ to /loki/rules/ on the Loki LXC; see deployment/loki-lxc-runbook.md.