groups: - name: scrobbler rules: - alert: ScrobblerDown expr: up{job="scrobbler-api"} == 0 for: 2m labels: {severity: critical} annotations: summary: Scrobbler API metrics endpoint is down description: Prometheus hasn't been able to scrape {{ $labels.instance }} for 2 minutes. - alert: HighErrorRate expr: | sum(rate(scrobbler_http_requests_total{status=~"5.."}[5m])) / sum(rate(scrobbler_http_requests_total[5m])) > 0.05 for: 5m labels: {severity: critical} annotations: summary: More than 5% of API requests are failing description: 5xx ratio is {{ $value | humanizePercentage }}. - alert: HighLatency expr: | histogram_quantile(0.95, sum by (le) (rate(scrobbler_http_request_duration_seconds_bucket[5m]))) > 1 for: 10m labels: {severity: warning} annotations: summary: API p95 latency is above 1s description: p95 latency is {{ $value | humanizeDuration }}. - alert: AuthFailureSpike expr: sum(rate(scrobbler_auth_failures_total[5m])) > 10 for: 5m labels: {severity: warning} annotations: summary: Unusually many authentication failures description: "{{ $value | humanize }} failures/s: check for a misconfigured client or credential stuffing." - alert: ScrobbleIgnoreRateHigh expr: | sum(rate(scrobbler_scrobbles_total{result="ignored"}[15m])) / sum(rate(scrobbler_scrobbles_total[15m])) > 0.2 for: 15m labels: {severity: warning} annotations: summary: More than 20% of scrobbles are being ignored description: A client may be sending bad timestamps or empty metadata. - alert: DBPoolExhausted expr: | sum(scrobbler_db_pool_connections{state="checked_out"}) >= sum(scrobbler_db_pool_connections{state="size"}) for: 5m labels: {severity: warning} annotations: summary: Every pooled database connection is in use description: Workers are running on overflow connections; requests may queue. - alert: ImportWorkerDown expr: up{job="scrobbler-worker"} == 0 for: 5m labels: {severity: warning} annotations: summary: The import worker isn't running description: History imports will wait until it's back. - alert: ImportJobsWaiting expr: max(scrobbler_import_jobs{status="pending"}) > 0 and max(scrobbler_import_jobs{status="running"}) == 0 for: 15m labels: {severity: warning} annotations: summary: Imports have been waiting for 15 minutes with nothing running description: The import worker is probably stopped or stuck. - alert: FederationDeliveryBacklog expr: max(scrobbler_federation_queue{queue="deliveries",status="pending"}) > 100 for: 30m labels: {severity: warning} annotations: summary: Over 100 fediverse deliveries have been waiting for 30 minutes description: Check the worker is running and outbound HTTPS works; one slow server can back up retries. - alert: FederationInboxBacklog expr: max(scrobbler_federation_queue{queue="inbox",status="queued"}) > 0 for: 15m labels: {severity: warning} annotations: summary: Received fediverse activities haven't been processed for 15 minutes description: The worker is probably stopped, or stuck on something. - alert: FederationSignatureFailures expr: | sum(rate(scrobbler_federation_signatures_total{direction="in",result!="ok"}[15m])) / sum(rate(scrobbler_federation_signatures_total{direction="in"}[15m])) > 0.2 for: 15m labels: {severity: warning} annotations: summary: More than 20% of incoming fediverse signatures are failing description: Check the Federation dashboard for the reason (e.g. a clock problem shows as 'expired'). - alert: PostgresDown expr: pg_up == 0 for: 2m labels: {severity: critical} annotations: summary: Postgres is unreachable from postgres-exporter