services.yml 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # Alert rules. Routed via alertmanager → alertmanager-discord bridge →
  2. # #briven-alerts (severity=critical|warning) or #briven-deploys (info).
  3. # Severity labels MUST match the route matchers in
  4. # infra/observability/alertmanager/alertmanager.yml.
  5. groups:
  6. - name: briven-services
  7. interval: 30s
  8. rules:
  9. - alert: ServiceDown
  10. expr: up == 0
  11. for: 2m
  12. labels:
  13. severity: critical
  14. annotations:
  15. summary: '{{ $labels.service }} is unreachable'
  16. description: '/metrics on {{ $labels.instance }} has been down for >2 minutes.'
  17. - alert: HighErrorRate
  18. # Triggers when a service's 5xx rate exceeds 5% over the last 5
  19. # minutes. Requires the service to expose http_requests_total
  20. # with a `status` label — apps/api should add this when its
  21. # /metrics endpoint lands.
  22. expr: |
  23. sum by (service) (rate(http_requests_total{status=~"5.."}[5m]))
  24. /
  25. sum by (service) (rate(http_requests_total[5m]))
  26. > 0.05
  27. for: 5m
  28. labels:
  29. severity: warning
  30. annotations:
  31. summary: '{{ $labels.service }} 5xx rate above 5%'
  32. - alert: PostgresConnectionsHigh
  33. expr: pg_stat_activity_count > 80
  34. for: 5m
  35. labels:
  36. severity: warning
  37. annotations:
  38. summary: 'postgres has {{ $value }} active connections (>80)'
  39. description: 'pool exhaustion is likely if this trends up.'