85 lines
2.5 KiB
YAML
85 lines
2.5 KiB
YAML
# GoChat Prometheus Alert Rules
|
|
# Reference: Chatwoot production monitoring with Sidekiq queue alerts
|
|
# Adjust thresholds based on your deployment scale
|
|
|
|
groups:
|
|
- name: gochat-app
|
|
rules:
|
|
# Application down
|
|
- alert: GoChatAppDown
|
|
expr: up{job="gochat"} == 0
|
|
for: 1m
|
|
labels:
|
|
severity: critical
|
|
annotations:
|
|
summary: "GoChat application is down"
|
|
description: "GoChat instance {{ $labels.instance }} has been down for more than 1 minute."
|
|
|
|
# High error rate
|
|
- alert: GoChatHighErrorRate
|
|
expr: rate(http_requests_total{job="gochat", status=~"5.."}[5m]) / rate(http_requests_total{job="gochat"}[5m]) > 0.05
|
|
for: 5m
|
|
labels:
|
|
severity: warning
|
|
annotations:
|
|
summary: "GoChat error rate above 5%"
|
|
description: "Error rate is {{ $value | humanizePercentage }} over the last 5 minutes."
|
|
|
|
# High memory usage
|
|
- alert: GoChatHighMemory
|
|
expr: gochat_go_memory_alloc_bytes / (1024 * 1024) > 400
|
|
for: 5m
|
|
labels:
|
|
severity: warning
|
|
annotations:
|
|
summary: "GoChat memory usage above 400MB"
|
|
description: "Memory allocation is {{ $value }}MB."
|
|
|
|
# Too many goroutines
|
|
- alert: GoChatHighGoroutines
|
|
expr: gochat_go_goroutines > 1000
|
|
for: 5m
|
|
labels:
|
|
severity: warning
|
|
annotations:
|
|
summary: "GoChat goroutine count above 1000"
|
|
description: "{{ $value }} goroutines running."
|
|
|
|
- name: gochat-infra
|
|
rules:
|
|
# PostgreSQL down
|
|
- alert: GoChatPostgresDown
|
|
expr: up{job="gochat-postgres"} == 0
|
|
for: 1m
|
|
labels:
|
|
severity: critical
|
|
annotations:
|
|
summary: "PostgreSQL is down"
|
|
|
|
# Redis down
|
|
- alert: GoChatRedisDown
|
|
expr: up{job="gochat-redis"} == 0
|
|
for: 1m
|
|
labels:
|
|
severity: critical
|
|
annotations:
|
|
summary: "Redis is down"
|
|
|
|
# Redis memory approaching limit
|
|
- alert: GoChatRedisMemoryHigh
|
|
expr: redis_memory_used_bytes / redis_memory_max_bytes > 0.8
|
|
for: 5m
|
|
labels:
|
|
severity: warning
|
|
annotations:
|
|
summary: "Redis memory usage above 80%"
|
|
|
|
# PostgreSQL connections exhausted
|
|
- alert: GoChatPostgresConnectionsHigh
|
|
expr: pg_stat_activity_count / pg_settings_max_connections > 0.8
|
|
for: 5m
|
|
labels:
|
|
severity: warning
|
|
annotations:
|
|
summary: "PostgreSQL connection usage above 80%"
|