Remove the metrics dashboard and monitoring package (v2.12.0)

The in-memory metrics system covered one gunicorn process at a time, was
lost on restart and was never used. Remove /admin/metrics-dashboard,
/admin/metrics, starpunk/monitoring, the HTTP/query timing, memory monitor,
feed counters, METRICS_* settings and psutil. Keep /health, /admin/health
(without its metrics block), pool stats and the feed cache. ADR-072.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
PhilandClaude Opus 5.5 committed 2026-11-03 16:07:47 -07:00
1 parent d6a916ba7d
commit 742e2e3ec3
36 files changed
+153 -2963

No files matched your search

+6 -15
View File
@@ -43,8 +43,6 @@ Key decisions:
[ADR-058](../decisions/ADR-058-image-optimization-strategy.md) (media),
[ADR-034](../decisions/ADR-034-full-text-search.md) (search),
[ADR-052](../decisions/ADR-052-configuration-system-architecture.md) (configuration),
[ADR-053](../decisions/ADR-053-performance-monitoring-strategy.md) and
[ADR-060](../decisions/ADR-060-production-hotfix-metrics-dashboard.md) (metrics),
[ADR-054](../decisions/ADR-054-structured-logging-architecture.md) (logging),
[ADR-055](../decisions/ADR-055-error-handling-philosophy.md) (errors).
@@ -65,7 +63,6 @@ Key decisions:
│ webmention worker works its queues only while holding a lock │
│ websub worker works its queues only while holding a lock │
│ syndication worker claims rows with a lease in SQLite │
│ memory monitor per-process metrics │
└───────────────┬──────────────────────────────┬─────────────────────┘
│ │
┌───────▼────────┐ ┌──────────▼──────────────────┐
@@ -86,7 +83,7 @@ Key decisions:
validates configuration, configures logging, cleans up old debug and
temporary upload files, creates the schema and runs migrations (under a
lock, see [database.md](database.md)), creates the connection pool,
installs the HTTP metrics middleware, configures the feed cache and rate
configures the feed cache and rate
limiters, fills the FTS index if it is empty, registers blueprints, error
handlers and template helpers, and starts the background threads.
3. `before_request` assigns a correlation ID (included in every log line) and,
@@ -94,8 +91,7 @@ Key decisions:
4. The blueprint handler runs. Database access goes through `get_db()`, which
hands out a pooled, request-scoped SQLite connection.
5. `after_request` hooks add `Link: </webmention>; rel="webmention"` to HTML
responses, WebSub `Link rel=hub` / `rel=self` headers to topic responses,
and request metrics with an `X-Request-ID` header.
responses, WebSub `Link rel=hub` / `rel=self` headers to topic responses.
6. Errors are rendered by the central handlers in `starpunk/errors.py`
(JSON for Micropub, HTML pages from `templates/<code>.html` elsewhere).
@@ -141,7 +137,6 @@ wait for outbound network calls; the workers make them later.
| `errors.py` | Central error handlers |
| `feeds/` | `rss.py` (feedgen), `atom.py`, `json_feed.py`, `opml.py`, `negotiation.py` (Accept header), `cache.py` (LRU + TTL feed cache with ETags) |
| `feed.py` | Backward-compatibility re-export of `feeds.rss` |
| `monitoring/` | Metrics buffer, HTTP middleware, database timing wrapper, memory monitor, business metrics |
| `database/` | `schema.py` (`INITIAL_SCHEMA_SQL`), `init.py` (`init_db`), `pool.py` (connection pool) |
| `migrations.py` | Migration runner for `migrations/NNN_*.sql` |
@@ -196,7 +191,7 @@ Everything works without JavaScript.
| `/admin/webmentions`, `/admin/webmentions/<id>`, `…/action`, `…/bulk-action` | Webmention moderation |
| `/admin/tokens`, `/admin/tokens/<id>/revoke` | Issued IndieAuth tokens |
| `/admin/syndication/<id>/retry` | Retry a failed crosspost |
| `/admin/metrics-dashboard`, `/admin/metrics`, `/admin/health` | Monitoring (HTML dashboard, JSON metrics, full diagnostics) |
| `/admin/health` | Full diagnostics (JSON): database, pool statistics, filesystem, disk |
| `/health` | Public liveness check (`{"status": "ok", "version": …}`); `?detailed=true` requires login |
## Background workers
@@ -210,7 +205,6 @@ coordinated through the data volume:
| Webmention worker (`webmention_worker.py`) | `WEBMENTION_WORKER_ENABLED` and not testing | Non-blocking `fcntl.flock` on `webmention-worker.lock` next to the database. Only the holder works the queues; the others try again each poll interval. The OS releases the lock if the holder dies, and the new holder resets rows stuck in `sending`. | Validates received webmentions; discovers endpoints and sends queued outgoing webmentions, with retries |
| WebSub worker (`websub_worker.py`) | `WEBSUB_ENABLED` and not testing | Same pattern with `websub-worker.lock` | Verifies subscription intents, delivers topic content (signed with `X-Hub-Signature` when the subscriber gave a secret), retries, expires leases; pings an external hub instead if `WEBSUB_HUB_URL` is set |
| Syndication worker (`syndication.py`) | At least one crosspost target configured, and not testing | No file lock. Rows in `syndications` are claimed with a 5-minute `claimed_until` lease by an atomic `UPDATE`, so any process may work a row but only one at a time; a `version` column keeps edits made during a send. Threads token refreshes are serialised with a lock file next to `threads_token.json`. | Creates, updates or deletes the remote post for each (note, target) pair; up to 8 attempts |
| Memory monitor (`monitoring/memory.py`) | `METRICS_ENABLED` and not testing | None (per-process metrics) | Samples process memory every `METRICS_MEMORY_INTERVAL` seconds |
All workers run inside an app context, are daemon threads (they end with the
process) and sleep for their poll interval when there is nothing to do. Under
@@ -326,14 +320,11 @@ their credentials are set. The full list with defaults is in
- Logs go to stdout and `logs/starpunk.log` (10 MB × 10 files); each line
carries the request's correlation ID.
- Metrics (`monitoring/`): HTTP request timings, database query timings
(with a slow-query threshold), memory, pool statistics and business
counters, in an in-memory buffer per process, shown at
`/admin/metrics-dashboard` and `/admin/metrics`.
- `/health` reports status, version and webmention-worker statistics;
`/health?detailed=true` checks database, filesystem and disk space;
`/admin/health` adds metrics, pool statistics and system information.
`/admin/health` adds pool statistics and filesystem details. (The metrics
dashboard was removed in v2.12.0, see ADR-072.)
---
**Last Updated**: 2026-11-03 (v2.10.1)
**Last Updated**: 2026-11-03 (v2.12.0)