diff --git a/deploy/grafana/dashboards/federation.json b/deploy/grafana/dashboards/federation.json index f075cb5..760cd9b 100644 --- a/deploy/grafana/dashboards/federation.json +++ b/deploy/grafana/dashboards/federation.json @@ -273,9 +273,22 @@ } }, { - "type": "timeseries", - "title": "Inbox deliveries / min", - "description": "Activities other servers send us (follows, likes, ...). Accepted but not yet processed until following is implemented.", + "type": "row", + "title": "Followers", + "id": 7, + "collapsed": false, + "gridPos": { + "x": 0, + "y": 18, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "type": "stat", + "title": "Followers", + "description": "", "datasource": { "type": "prometheus", "uid": "prometheus" @@ -286,11 +299,577 @@ "type": "prometheus", "uid": "prometheus" }, - "expr": "sum by (inbox) (rate(scrobbler_federation_inbox_requests_total[$__rate_interval])) * 60", - "legendFormat": "{{inbox}}", + "expr": "max(scrobbler_federation_followers{state=\"accepted\"})", + "legendFormat": "__auto", "refId": "A" } ], + "fieldConfig": { + "defaults": { + "unit": "short", + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "text", + "value": null + } + ] + } + }, + "overrides": [] + }, + "options": { + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "colorMode": "value", + "graphMode": "area", + "textMode": "auto", + "justifyMode": "auto" + }, + "id": 8, + "gridPos": { + "x": 0, + "y": 19, + "w": 6, + "h": 5 + } + }, + { + "type": "stat", + "title": "Follow requests waiting", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "expr": "max(scrobbler_federation_followers{state=\"pending\"})", + "legendFormat": "__auto", + "refId": "A" + } + ], + "fieldConfig": { + "defaults": { + "unit": "short", + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "text", + "value": null + } + ] + } + }, + "overrides": [] + }, + "options": { + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "colorMode": "value", + "graphMode": "area", + "textMode": "auto", + "justifyMode": "auto" + }, + "id": 9, + "gridPos": { + "x": 6, + "y": 19, + "w": 6, + "h": 5 + } + }, + { + "type": "stat", + "title": "Deliveries waiting", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "expr": "max(scrobbler_federation_queue{queue=\"deliveries\",status=\"pending\"})", + "legendFormat": "__auto", + "refId": "A" + } + ], + "fieldConfig": { + "defaults": { + "unit": "short", + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "text", + "value": null + }, + { + "color": "orange", + "value": 50 + }, + { + "color": "red", + "value": 100 + } + ] + } + }, + "overrides": [] + }, + "options": { + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "colorMode": "value", + "graphMode": "area", + "textMode": "auto", + "justifyMode": "auto" + }, + "id": 10, + "gridPos": { + "x": 12, + "y": 19, + "w": 6, + "h": 5 + } + }, + { + "type": "stat", + "title": "Inbox waiting", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "expr": "max(scrobbler_federation_queue{queue=\"inbox\",status=\"queued\"})", + "legendFormat": "__auto", + "refId": "A" + } + ], + "fieldConfig": { + "defaults": { + "unit": "short", + "thresholds": { + "mode": "absolute", + "steps": [ + { + "color": "text", + "value": null + }, + { + "color": "orange", + "value": 10 + }, + { + "color": "red", + "value": 50 + } + ] + } + }, + "overrides": [] + }, + "options": { + "reduceOptions": { + "calcs": [ + "lastNotNull" + ], + "fields": "", + "values": false + }, + "colorMode": "value", + "graphMode": "area", + "textMode": "auto", + "justifyMode": "auto" + }, + "id": 11, + "gridPos": { + "x": 18, + "y": 19, + "w": 6, + "h": 5 + } + }, + { + "type": "row", + "title": "Inbox", + "id": 12, + "collapsed": false, + "gridPos": { + "x": 0, + "y": 24, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "type": "timeseries", + "title": "Activities received / min", + "description": "queued/duplicate/blocked/invalid at intake; processed/rejected/failed after verification.", + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "expr": "sum by (type, result) (rate(scrobbler_federation_inbox_activities_total[$__rate_interval])) * 60", + "legendFormat": "{{type}} {{result}}", + "refId": "A" + } + ], + "fieldConfig": { + "defaults": { + "unit": "short", + "custom": { + "lineWidth": 2, + "fillOpacity": 40, + "showPoints": "never", + "spanNulls": true, + "stacking": { + "mode": "normal", + "group": "A" + } + }, + "min": 0 + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "id": 13, + "gridPos": { + "x": 0, + "y": 25, + "w": 12, + "h": 8 + } + }, + { + "type": "timeseries", + "title": "Incoming signatures by result", + "description": "Per minute. Anything but 'ok' is a delivery we refused; bad_signature after a refresh usually means a forged or broken sender.", + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "expr": "sum by (scheme, result) (rate(scrobbler_federation_signatures_total{direction=\"in\"}[$__rate_interval])) * 60", + "legendFormat": "{{scheme}} {{result}}", + "refId": "A" + } + ], + "fieldConfig": { + "defaults": { + "unit": "short", + "custom": { + "lineWidth": 2, + "fillOpacity": 40, + "showPoints": "never", + "spanNulls": true, + "stacking": { + "mode": "normal", + "group": "A" + } + }, + "min": 0 + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "id": 14, + "gridPos": { + "x": 12, + "y": 25, + "w": 12, + "h": 8 + } + }, + { + "type": "row", + "title": "Deliveries", + "id": 15, + "collapsed": false, + "gridPos": { + "x": 0, + "y": 33, + "w": 24, + "h": 1 + }, + "panels": [] + }, + { + "type": "timeseries", + "title": "Deliveries / min by result", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "expr": "sum by (result) (rate(scrobbler_federation_deliveries_total[$__rate_interval])) * 60", + "legendFormat": "{{result}}", + "refId": "A" + } + ], + "fieldConfig": { + "defaults": { + "unit": "short", + "custom": { + "lineWidth": 2, + "fillOpacity": 40, + "showPoints": "never", + "spanNulls": true, + "stacking": { + "mode": "normal", + "group": "A" + } + }, + "min": 0 + }, + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "delivered" + }, + "properties": [ + { + "id": "color", + "value": { + "mode": "fixed", + "fixedColor": "green" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "retry" + }, + "properties": [ + { + "id": "color", + "value": { + "mode": "fixed", + "fixedColor": "orange" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "abandoned" + }, + "properties": [ + { + "id": "color", + "value": { + "mode": "fixed", + "fixedColor": "red" + } + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "gone" + }, + "properties": [ + { + "id": "color", + "value": { + "mode": "fixed", + "fixedColor": "purple" + } + } + ] + } + ] + }, + "options": { + "legend": { + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "id": 16, + "gridPos": { + "x": 0, + "y": 34, + "w": 12, + "h": 8 + } + }, + { + "type": "timeseries", + "title": "Delivery latency", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "expr": "histogram_quantile(0.50, sum by (le) (rate(scrobbler_federation_delivery_seconds_bucket[$__rate_interval])))", + "legendFormat": "p50", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "expr": "histogram_quantile(0.95, sum by (le) (rate(scrobbler_federation_delivery_seconds_bucket[$__rate_interval])))", + "legendFormat": "p95", + "refId": "B" + } + ], + "fieldConfig": { + "defaults": { + "unit": "s", + "custom": { + "lineWidth": 2, + "fillOpacity": 10, + "showPoints": "never", + "spanNulls": true + }, + "min": 0 + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "id": 17, + "gridPos": { + "x": 12, + "y": 34, + "w": 12, + "h": 8 + } + }, + { + "type": "timeseries", + "title": "Queues", + "description": "", + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "expr": "max(scrobbler_federation_queue{queue=\"deliveries\",status=\"pending\"})", + "legendFormat": "deliveries waiting", + "refId": "A" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "expr": "max(scrobbler_federation_queue{queue=\"inbox\",status=\"queued\"})", + "legendFormat": "inbox waiting", + "refId": "B" + }, + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "expr": "max(scrobbler_federation_queue{queue=\"inbox\",status=\"processing\"})", + "legendFormat": "inbox processing", + "refId": "C" + } + ], "fieldConfig": { "defaults": { "unit": "short", @@ -315,12 +894,67 @@ "sort": "desc" } }, - "id": 7, + "id": 18, "gridPos": { "x": 0, - "y": 18, - "w": 24, - "h": 7 + "y": 42, + "w": 12, + "h": 8 + } + }, + { + "type": "timeseries", + "title": "Outgoing signatures by scheme", + "description": "Which scheme deliveries were finally sent with. rfc9421 means the first try got a 401 (double-knocking).", + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "prometheus" + }, + "expr": "sum by (scheme) (rate(scrobbler_federation_signatures_total{direction=\"out\"}[$__rate_interval])) * 60", + "legendFormat": "{{scheme}}", + "refId": "A" + } + ], + "fieldConfig": { + "defaults": { + "unit": "short", + "custom": { + "lineWidth": 2, + "fillOpacity": 40, + "showPoints": "never", + "spanNulls": true, + "stacking": { + "mode": "normal", + "group": "A" + } + }, + "min": 0 + }, + "overrides": [] + }, + "options": { + "legend": { + "displayMode": "list", + "placement": "bottom", + "showLegend": true + }, + "tooltip": { + "mode": "multi", + "sort": "desc" + } + }, + "id": 19, + "gridPos": { + "x": 12, + "y": 42, + "w": 12, + "h": 8 } } ] diff --git a/deploy/prometheus/alerts.yml b/deploy/prometheus/alerts.yml index a0c6cd4..81f451d 100644 --- a/deploy/prometheus/alerts.yml +++ b/deploy/prometheus/alerts.yml @@ -73,6 +73,32 @@ groups: 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