Metrics, dashboard and alert for posts (phase 3, step 9)
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

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
This commit is contained in:
mattandClaude Sonnet 5 committed 2026-09-26 16:31:16 +01:00
1 parent 0acce9b948
commit de1519a066
9 files changed
+300 -8

No files matched your search

+233
View File
@@ -956,6 +956,239 @@
"w": 12,
"h": 8
}
},
{
"type": "row",
"title": "Posts",
"id": 20,
"collapsed": false,
"gridPos": {
"x": 0,
"y": 50,
"w": 24,
"h": 1
},
"panels": []
},
{
"type": "timeseries",
"title": "Posts / min by kind and visibility",
"description": "Weekly summaries and milestones actually published.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum by (kind, visibility) (rate(scrobbler_federation_posts_total[$__rate_interval])) * 60",
"legendFormat": "{{kind}} {{visibility}}",
"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": 21,
"gridPos": {
"x": 0,
"y": 51,
"w": 12,
"h": 8
}
},
{
"type": "timeseries",
"title": "Post deletions / min by reason",
"description": "'manual' from the web UI, 'sharing_off' when a user turns sharing off.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum by (reason) (rate(scrobbler_federation_post_deletions_total[$__rate_interval])) * 60",
"legendFormat": "{{reason}}",
"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": 22,
"gridPos": {
"x": 12,
"y": 51,
"w": 12,
"h": 8
}
},
{
"type": "timeseries",
"title": "Weekly summary checks / min by result",
"description": "disabled, skipped_empty, already_posted or posted.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum by (result) (rate(scrobbler_federation_weekly_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": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
},
"id": 23,
"gridPos": {
"x": 0,
"y": 59,
"w": 12,
"h": 8
}
},
{
"type": "timeseries",
"title": "Milestone checks / min by result",
"description": "disabled, none or posted.",
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "prometheus"
},
"expr": "sum by (result) (rate(scrobbler_federation_milestone_checks_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": []
},
"options": {
"legend": {
"displayMode": "list",
"placement": "bottom",
"showLegend": true
},
"tooltip": {
"mode": "multi",
"sort": "desc"
}
},
"id": 24,
"gridPos": {
"x": 12,
"y": 59,
"w": 12,
"h": 8
}
}
]
}