feat(obs): add Loki ruler alert rules and MONITORING.md Loki section (BIT-19957)
- 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
This commit is contained in:
1 parent
c74e05b844
commit
113eee0b97
4 files changed
+142
No files matched your search
@@ -39,6 +39,13 @@ schema_config:
|
||||
|
||||
ruler:
|
||||
alertmanager_url: http://localhost:9093
|
||||
storage:
|
||||
type: local
|
||||
local:
|
||||
directory: /loki/rules
|
||||
rule_path: /tmp/loki-ruler-tmp
|
||||
enable_api: true
|
||||
enable_alertmanager_v2: true
|
||||
|
||||
limits_config:
|
||||
retention_period: 30d
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
# Loki ruler alert rules — errors.bitreport.pt (errors-hub)
|
||||
# Tenant: fake (auth_enabled: false single-binary)
|
||||
# Labels app="errors-hub", env="production" are set by promtail (both Docker and LXC configs).
|
||||
# Service label values: ingest-api, api, collector-worker, admin-ui, web
|
||||
# Docs: docs/OBSERVABILITY_LOKI.md
|
||||
|
||||
groups:
|
||||
- name: errors_hub_log_alerts
|
||||
interval: 1m
|
||||
rules:
|
||||
# ── Error rate per service ─────────────────────────────────────────────
|
||||
- alert: ErrorsHubServiceErrorRateHigh
|
||||
expr: |
|
||||
sum by (service) (
|
||||
rate({app="errors-hub", level="error"}[5m])
|
||||
) > 0.1
|
||||
for: 5m
|
||||
labels:
|
||||
severity: warning
|
||||
team: observability
|
||||
app: errors-hub
|
||||
annotations:
|
||||
summary: "High error log rate on {{ $labels.service }}"
|
||||
description: >
|
||||
Service {{ $labels.service }} is emitting error-level logs at
|
||||
{{ $value | printf "%.2f" }} lines/s (threshold 0.1/s, 5m window).
|
||||
Check service health; run: docker compose logs {{ $labels.service }} --tail=100
|
||||
|
||||
# ── Fatal log detected ─────────────────────────────────────────────────
|
||||
- alert: ErrorsHubFatalLogDetected
|
||||
expr: |
|
||||
sum by (service) (
|
||||
rate({app="errors-hub", level="fatal"}[5m])
|
||||
) > 0
|
||||
for: 1m
|
||||
labels:
|
||||
severity: critical
|
||||
team: observability
|
||||
app: errors-hub
|
||||
annotations:
|
||||
summary: "Fatal log in {{ $labels.service }}"
|
||||
description: >
|
||||
Service {{ $labels.service }} emitted at least one fatal-level log
|
||||
in the last 5 minutes. Immediate investigation required.
|
||||
Query: {app="errors-hub", service="{{ $labels.service }}", level="fatal"}
|
||||
|
||||
# ── Ingest API sustained error rate ───────────────────────────────────
|
||||
- alert: ErrorsHubIngestApiHighErrorRate
|
||||
expr: |
|
||||
rate({app="errors-hub", service="ingest-api", level="error"}[10m]) > 0.05
|
||||
for: 10m
|
||||
labels:
|
||||
severity: critical
|
||||
team: observability
|
||||
app: errors-hub
|
||||
annotations:
|
||||
summary: "ingest-api sustained error rate (>0.05/s for 10m)"
|
||||
description: >
|
||||
ingest-api is logging errors at {{ $value | printf "%.3f" }} lines/s
|
||||
for 10+ minutes. This may indicate DB connection issues, schema errors,
|
||||
or upstream pressure. Check: {service="ingest-api", level="error"} | json
|
||||
|
||||
# ── Collector worker stalled ───────────────────────────────────────────
|
||||
- alert: ErrorsHubCollectorWorkerStalled
|
||||
expr: |
|
||||
sum(
|
||||
rate({app="errors-hub", service="collector-worker"}[10m])
|
||||
) == 0
|
||||
for: 15m
|
||||
labels:
|
||||
severity: warning
|
||||
team: observability
|
||||
app: errors-hub
|
||||
annotations:
|
||||
summary: "collector-worker has no log output for 15m"
|
||||
description: >
|
||||
collector-worker emitted zero log lines over the last 10m window for
|
||||
15+ minutes. The service may be stopped or stuck in a silent loop.
|
||||
Check: docker compose ps collector-worker; systemctl status bitreport-error-reporting-collector-worker
|
||||
Reference in new issue
Block a user