Files
Scrobbler/deploy/prometheus/alerts.yml
T
mattandClaude Sonnet 5 de1519a066
CI / validate-monitoring (push) Successful in 8s
CI / lint (push) Successful in 13s
CI / federation-interop (push) Successful in 59s
CI / test (push) Successful in 2m53s
CI / images (push) Skipped
CI / assets (push) Skipped
CI / python-package (push) Skipped
CI / notify (push) Successful in 6s
Metrics, dashboard and alert for posts (phase 3, step 9)
New counters: scrobbler_federation_posts_total{kind,visibility},
post_deletions_total{reason} (manual vs sharing_off), and
milestone_checks_total / weekly_total{result}, each incremented at a
single point (publish()/_delete(), and a thin public wrapper around
each module's check_and_post()) rather than at every call site.

Federation dashboard gains a "Posts" row: posts/min by kind and
visibility, deletions/min by reason, and weekly/milestone checks by
result - the same shape as the existing rows, so a stalled worker (all
zero) looks the same as one with nothing to do (all "disabled"/"none").

New alert FederationWeeklySummariesMissing, on scrobbler_worker_tasks_total
rather than the new weekly_total metric: weekly_total only increments
once check_all() reaches a real sharing user, so on a quiet instance
with nobody sharing yet it would sit at zero forever and false-alarm
immediately. worker_tasks_total counts every periodic run regardless of
whether there was anyone to check, matching the same pattern already
used by ImportWorkerDown and FederationInboxBacklog.

Verified deploy/prometheus/alerts.yml and prometheus.yml with promtool
(via the prom/prometheus image, matching CI's validate-monitoring job).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MK52BGoJbPhZ1vSFuKcGUW
2026-09-26 16:31:16 +01:00

116 lines
4.7 KiB
YAML

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: FederationWeeklySummariesMissing
expr: sum(increase(scrobbler_worker_tasks_total{task="federation.weekly"}[30m])) == 0
for: 5m
labels: {severity: warning}
annotations:
summary: The weekly summary check hasn't run in 30 minutes
description: federation.weekly runs every 15 minutes regardless of whether anyone is due a post; the worker is probably stopped or stuck.
- 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