Repository navigation
Description
Problem
Health probes and metric scrapes make up 92.8 % of REST requests. In the 7 days to 2026-11-10 00:00Z, they made 441,735 of 476,161 REST requests (Measured). The REST error and latency alerts therefore measure the probes, not the API.
First read, 7 days to 2026-11-07, from http_requests_total{job="rest-api"}. The 2026-11-10 totals supersede it. It stays for the per-route split:
| Route | Requests |
|---|---|
/health/live |
241,782 |
/health/database |
119,457 |
/metrics |
40,295 |
/health |
20,173 |
/health/supabase |
20,149 |
/api/documents/:docName (the busiest real route) |
16,335 |
In that first read, probes and scrapes totalled 441,856 of about 467,000 requests.
- "HTTP 5xx ratio per service (>5%)" (
slo-http-5xx-ratioinscripts/observability/grafana/provisioning/alerting/rules-app-slo.yml) divides by every request. If every real API request failed, the ratio would reach only about 5%. - "App request p95 latency (>1s)" (
slo-latency-p95-app, same file) reads the same mix. The 1-day p95 was 0.17 s, mostly probe time. - "Edge p95 latency" (
slo-latency-p95-edge) pools every HTTP service behind Traefik. GlitchTip (127,550) and webapp (147,970) requests outweighrest-api(60,185) in about 345,000. Cut MCP write time on large pads and stop its four false alerts #726 Decision 5 splits out only/api/mcp. - The first 5xx on a route after a deploy is not counted.
http_requests_totalhas no seeded5xxseries, soincrease()misses its first increment. Prometheus counted 3/health/database503answers where Loki logged 5 in the same week. - The 5xx rule comment is wrong. It says the WebSocket process has no HTTP timer.
apps/hocuspocus.server/src/hocuspocus.server.tsadded one on 2026-09-05.
A real slowdown went unpaged. On 2026-11-01, REST logged 5 /health/database checks that timed out after 2000 ms, between 17:20 and 22:25 UTC. At 22:25 the webapp failed page loads with DocumentFetchError, and Traefik answered 5 webapp 500s. No alert fired.
Filtering out the probes has side effects. The Step 0 backtest (Measured) reads the latency side on W7, 2026-11-03 00:00Z to 2026-11-10 00:00Z:
- The probe filter alone fires more: 54 shape (b) minutes and 28 Grafana Firing minutes, against 17 and 16 today. Its one firing, 28 minutes, falls in the 2026-11-09 MCP session.
/api/mcpsits at 2.19 s p95. Without/api/mcp, the rule reads 26 shape (b) minutes and 0 Grafana firings. Real traffic is about 3.2 requests a minute. - The review backtest read 81 and 53 minutes (review read, other window). The Measured W7 values replace them.
- With the probes gone, the 5xx ratio runs on about 16 requests per 5 minutes. One error is about 6 %, above the 5 % line.
increase()extrapolates: on 2026-11-01 it read 1.034 and then 2.069. Agt 1.5database-health rule withfor: 0sfires at 18:46Z (18:51Z withfor: 5m). That is 3 h 39 min before the 22:25Z failures (Measured).
Step 0 is posted, so the 2026-11-01 data may now leave Prometheus.
Benchmark
| Field | Value |
|---|---|
| Metric | (a) Probe and scrape share of the 5xx and latency denominators, %. (b) Minutes Firing, slo-latency-p95-app, 7-day backtest, by Grafana replay count. (c) Breach minutes, guarded 5xx ratio, 7-day backtest. (d) Database-health rule fire time on 2026-11-01. (e) Fire test (step 6): cases that reach the expected state, and time to Firing. (f) hocuspocus code-0 requests counted as errors in AP 3, 5, 33 and 34, 7 days. (g) Panels in app-performance.json with a wrong value, count |
| Before | Step 0, Measured. (a) 441,735 of 476,161 (92.8 %), 7 days to 2026-11-10 00:00Z. (b) W7 Grafana count: 16 Firing minutes today (shape (b) 17). The probe filter with no guard: 28 (shape (b) 54). The new expression: 0 (shape (b) 26). Review read, other window: 81 and 53. (c) 0, but no real 5xx happened, so the guard is untested. (d) no alert. (e) not tested. (f) 5,111.3 of 5,155.3. (g) 10 (AP 3, 5, 6, 7, 24, 25, 32, 33, 34, 45) |
| After | 3 days to 2026-11-16 14:00Z (Measured): (a) 0 %. (b) 0. (c) 0, guard untested in production; the step 6 promtool case covers it. (f) 0. (g) 0. (e) 7 of 7 (Measured). The 7-day after of (a), (b) and (f) is owed (step 9) |
| Condition | Production Prometheus, rules evaluated each minute. Backtest windows: 2026-11-01 17:00Z to 23:00Z, and the 7 days to 2026-11-10 00:00Z. Fire test with promtool test rules on synthetic series, no production access (step 6) |
| How to run | (a) sum by (route) (increase(http_requests_total{job="rest-api"}[7d])) at 2026-11-10 00:00Z. (b) count_over_time((min_over_time(<p95 expr>[10m:1m]) > 1)[7d:1m]) for the old and new expressions. (c), (d) the same subquery shape for the 5xx and database-health expressions. (e) Step 6. (f), (g) panel queries in Grafana after the deploy |
| Pass rule | (a) 0 %. (b) 0 outside known incidents, by the Grafana replay count; shape (b) is context only. (c) 0. (d) fires at 18:46Z on 2026-11-01 (for: 0s). (e) every step 6 case reaches its expected state; post the time to Firing per case. (f) 0. (g) 0. Revert rule: if a new rule fires outside a real incident in the first 7 days, run the Rollback |
| Guard | Rule count: the count before this change + 2. If this ships with other rule changes, the #753 want for that deploy is the check. The #753 Verify step reports got = want and error_health=0. Depends on #753 |
| Owner | Agent in the repo: rule and panel edits, step 6 fire test. Maintainer: Step 0 (done), production reads, deploy after #753 |
| Claim | "Our API error alert now reads only real API traffic. Health probes made 92.8 % of its input before and 0 % now." |
What to do
-
Maintainer, read-only. Done 2026-11-11 (Measured). Run the old and new 5xx, latency, MCP latency and database-health expressions over 2026-11-01 17:00Z to 23:00Z. Run them again over the 7 days to 2026-11-10 00:00Z. Post the raw values and the first fire time. Step 0 needs no deploy, so it runs now.
-
Agent in the repo. 5xx rule (
slo-http-5xx-ratio): addroute!~"/health.*|/metrics"to the numerator and the denominator. Add a volume guard:and on() (sum(increase(http_requests_total{job="rest-api",route!~"/health.*|/metrics"}[10m])) >= 20). Fix the rule comment:hocuspocus.server.tshas had an HTTP timer since 2026-09-05. -
Agent in the repo. Latency rule (
slo-latency-p95-app): useroute!~"/health.*|/metrics|/api/mcp". No volume guard and no threshold change: the Step 0 backtest reads 0 Grafana firings at 1 s in W7. Keep health checks out of the API error and latency alerts #710 writes the final App p95 selector. Cut MCP write time on large pads and stop its four false alerts #726 owns only the MCP Traefik router. -
Agent in the repo. New MCP latency rule, so
/api/mcpis not left out of all alerting.uid: slo-latency-p95-mcp, severity warning,noDataState: OK. A:histogram_quantile(0.95, sum by (le) (rate(http_request_duration_seconds_bucket{job="rest-api",route="/api/mcp"}[5m]))). Bar 5 s (ruling 2026-11-11, comment). At 5 s it fires once in W7, on the 2026-11-09 MCP session, which counts as a real incident. Cut MCP write time on large pads and stop its four false alerts #726 only rechecks the bar after its after-session. -
Agent in the repo. New database-health rule. A =
sum(increase(http_requests_total{job="rest-api",route="/health/database",status="503"}[15m])), C =gt 1.5,for: 0s, severity warning,noDataState: OK. Seed onlyhttp_requests_total{method="GET",route="/health/database",status="503"}at 0 at REST start. Confirm themethodlabel that the middleware writes. -
Agent in the repo. Edge rule (
slo-latency-p95-edge):histogram_quantile(0.95, sum by (le, service) (rate(traefik_service_request_duration_seconds_bucket{service=~"rest-api.*|webapp.*",service!~".*mcp.*"}[5m]))). The selector must leave out the Cut MCP write time on large pads and stop its four false alerts #726 MCP service. Cut MCP write time on large pads and stop its four false alerts #726 confirms that its Traefik service matches.*mcp.*; that check is not part of this issue. -
Agent in the repo, fire test. The repo has no local Prometheus and Grafana stack (the Makefile runs observability on the server only). So test the expressions with
promtool test rules(it ships in the Prometheus image). Write a temporary rule file with the same expressions, and synthetic input series. It needs no production access. Cases:- Database health: two
/health/database503answers within 15 min give Firing. One gives Normal. - 5xx guard: 20 or more non-probe requests in 10 min, with over 5 %
5xx, give Firing. Fewer than 20 requests give Normal. - Record the time to Firing per case.
- If the maintainer wants a Grafana-side test instead, first write the full local recipe here. Name the compose command, dummy env, scrape target, request loop and the container to stop.
- Database health: two
-
Agent in the repo. Fix the panels in
app-performance.json, in the same change as the rules:Panel Problem Fix AP 7, and the hocuspocusrows of AP 6, 32 and 34For a WebSocket, Traefik's duration is the connection's lifetime, so p95 sits at the 5 s top bucket Leave the hocuspocusrouter out of latency panelsAP 3, 5, 33 and 34 They count code 0, a normal WebSocket close, as an error. hocuspocuscode 0 was 5,111.3 of 5,155.3 requests in 7 daysLeave the hocuspocusrouter out of the code-0 term. Keep code 0 for HTTP services, where it means no response (so AP 14 and 16 stay)AP 24 and 25 No datnamefilter, so they add up every database on the clusterFilter on the collab database datname. The maintainer reads it frompg_database_size_bytesafter the 2026-11-11 London moveAP 45 "GC Rate by Job" Always empty under Bun Delete it -
Maintainer, observability deploy, after Fail the observability deploy when Grafana or its provisioned rules do not load #753. Commit through the
commit-reviewskill with a(build): observabilitysubject and push. -
Agent, read-only, on or after 2026-11-19. The one task left. Steps 0 to 8 are done: rules live since 2026-11-12, panels since 2026-11-16 13:43Z (
288d4d260). Read (a), (b) and (f) over 7 days by the Step 0 method. Post them, log them in v2.3.7 benchmark ledger: every quotable claim, with n, range, condition and source #796, then close. Do not re-read (c): no real 5xx can test it, and the step 6 promtool case covers the guard.
The event-loop rule moves to #729, because it needs a different metric.
Decisions
Decisions 1 and 2 were ruled as shipped on 2026-11-16 (ruling).
- Should a failed
/health/databasecheck alert on its own? Recommended: yes, at warning severity, on the step 4 expression (gt 1.5over 15 minutes). It was the only early sign on 2026-11-01. - Should we seed the
5xxseries? Recommended: seed onlyhttp_requests_total{method="GET",route="/health/database",status="503"}at 0 at REST start. Leave every other route unseeded. Prometheus counted 3 of 5 logged 503s, so the first 503 after each deploy is lost without the seed. Seeding every route would need a list of routes to keep in step. - MCP latency alert? Ruled 2026-11-11 (comment): this issue ships
slo-latency-p95-mcpat a 5 s bar. Cut MCP write time on large pads and stop its four false alerts #726 owns only the MCP Traefik router and the MCP edge rule.
Acceptance
- Step 0 values and the first fire time are posted (Measured).
- Both rules leave out
/health*and/metrics. The 5xx rule has the volume guard. - In Grafana Explore, the new 5xx expression reads 0 while only probes run.
- The latency rule backtest reads 0 Grafana firings outside known incidents (W7, Measured).
-
/api/mcplatency has its own rule,slo-latency-p95-mcp, at a 5 s bar. - Every step 6
promtoolcase passes, for the database-health rule and the 5xx guard. - Each panel in the step 7 table shows the corrected value in Grafana.
- Grafana holds the count before this change + 2 rules.
- Step 9: the 7-day (a), (b) and (f) reads are posted and logged in v2.3.7 benchmark ledger: every quotable claim, with n, range, condition and source #796.
Rollback
Revert the commit and run the observability deploy.
Found in the production review of 2026-11-07.
Activity
HMarzban commentedon Nov 11, 2026
Update, 2026-11-10: one more rule, and panels with the same problem
v2.3.6 takes this issue. In the 7 days to 2026-11-10, probes and scrapes made 441,800 of 474,600 REST requests (93 %).
One more rule
slo-latency-p95-edge) pools every HTTP service behind Traefik. GlitchTip (127,550) and webapp (147,970) requests outweighrest-api(60,185) in about 345,000. Cut MCP write time on large pads and stop its four false alerts #726 Decision 5 splits out only/api/mcp.apps/hocuspocus.server/src/hocuspocus.server.ts:652added one on 2026-09-05. Fix the comment in the same change.Panels in
app-performance.jsonthat show the wrong thinghocuspocusrows of AP 6, 32 and 34hocuspocusrouter out of latency panelshocuspocuscode 0 was 5,111.3 of 5,155.3 requests in 7 days|0fromcode=~"5..|0"datnamefilter, so they add up all 8 databases on the clusterProposed added step
Added acceptance item: each panel in the table shows the corrected value in Grafana.
HMarzban commentedon Nov 11, 2026
Measured, 2026-11-11. Step 0 backtest of the old and new rule expressions, read-only on production Prometheus.
How this was read
for: 10mcan build up.count_over_time((min_over_time(<expr>[10m:1m]) > <bar>)[7d:1m]), instant at 2026-11-10 00:00Z.min_over_timeskips NaN samples. So a few slow requests with empty minutes between them still count.for. Firing starts at the 11th breach in a row (for: 10m). A firing is one change from Normal to Firing.gtis a plainf > bartest, so NaN gives 0, and 0 is Normal (Grafana source,pkg/expr/threshold.go).Expressions
(a) Probe and scrape share, 7 days to 2026-11-10 00:00Z
sum by (route) (increase(http_requests_total{job="rest-api"}[7d])):/health*and/metricsmade 441,735 of 476,161 requests (92.8 %)./api/mcpmade 2,294.W1: 2026-11-01, 17:00Z to 23:00Z
for: 0sfor: 5mfor: 10mrule fired on it.5xxseries outside/health*exists in the last 15 days. So the new 5xx expression has no data, and Grafana reads it as OK.W7: 2026-11-03 00:00Z to 2026-11-10 00:00Z
Shape (b) minutes by hour (UTC):
What this means for the pass rule
/api/mcpis what makes this rule pass.for: 0s(18:51Z withfor: 5m). That is 3 h 39 min before the 22:25Z failures. Pass.710-*.jsonbeside this file.HMarzban commentedon Nov 11, 2026
Maintainer ruling, 2026-11-11
slo-latency-p95-mcp. The rule count becomes before + 2. Cut MCP write time on large pads and stop its four false alerts #726 owns only the MCP Traefik router and the MCP edge rule, and it rechecks the bar after its after-session.fix(observability): keep health probes out of the app alert rules
fix(observability): name the 5xx rule for REST and trim its summary
docs(changelog): cover each v2.3.6 change in its own package
HMarzban commentedon Nov 12, 2026
Measured, 2026-11-12: production after the observability deploy. Run 43224277563 (
(build): observability,f61647754). Steps 1 to 8 passed, including "Deploy stack" at 13:08:16Z. A newer push cancelled the last step, Verify, during its wait, so its checks were read by hand, read-only, at about 13:12Z.slo-latency-p95-mcpanddep-rest-db-health-503from this issue, plus the three Alert before the shared collab Postgres cluster fills its disk #727 rules. 0 rules are in error health./health/database503 seed ships with the(build): back frontdeploy (run 43224537614), so its series appears after that deploy.HMarzban commentedon Nov 12, 2026
Measured, 2026-11-12: the 503 seed is live. After the
(build): back frontdeploy (run 43224537614,9f132692e, green at 13:18:36Z), Prometheus readshttp_requests_total{job="rest-api",route="/health/database",status="503"}= 0 on both REST replicas. Before the deploy the series did not exist, soincrease()missed the first 503 after each start.dep-rest-db-health-503now counts it.HMarzban commentedon Nov 14, 2026
Moved to v2.3.7 at the v2.3.6 release audit. Rules are live, but the after values (a) to (g) and the promtool fire test are not posted.
docs(changelog): quote exact benchmark numbers with conditions
fix(observability): correct the app dashboard panels
HMarzban commentedon Nov 16, 2026
Measured, 2026-11-16
This covers steps 6 and 7, committed in
6a99bee10. Steps 1 to 5 were already in the repo (5dcc63ff4,55e2d6af8) and live since 2026-11-12, so no rule changed.What changed
methodfromc.req.method, which isGET. The seed usesmethod="GET", so the labels match.promtool test rules(prom/prometheus:v3.12.0) runs the expressions read from the live rule files on synthetic series. Every case reaches its expected state.hocuspocus. In AP 3, 5, 33 and 34 (D), only 5xx counts forhocuspocus. Code 0 still counts onrest-apiandwebapp. AP 14 and 16 are unchanged. AP 45 is deleted, and AP 44 now fills its row (w12 to w24; the issue names only the delete).datname="prod_docsplus". Thedatnamewas read from productionpg_database_size_byteson 2026-11-16: the exporter lists 8 databases on the shared cluster, andprod_docsplusis the collab database.Fire test (step 6)
The eval interval is 1 min. Probes run at 124 req/min in the 5xx cases.
/health/database503 every minThe last row shows why the seed matters: without it,
increase()reads about 1.1 for two 503s.Before and after
prod_docsplus)hocuspocusbarhocuspocus5xx)hocuspocusp95grep -c '^ - uid:'. HEAD then held 64; the 66 includes the 2 #749 rules (f47ea3bd9). This change adds 0(f) and (g) in production stay with the after reads below.
Gates
bunx prettier --check app-performance.json: pass.python3 -m json.tool(the CI step): pass.promtool check rulesandpromtool test rules: pass.promtool check rules: pass.--network none, dummy contact points: 73 panels, 66 of 66 rules. Pass.Left
.*mcp.*. Owner: Cut MCP write time on large pads and stop its four false alerts #726.clamp_min(req/s, 1), which deflates the error % under 1 req/s. REST runs at about 0.79 req/s. Owner: maintainer to rule.(build): observability. Owner: maintainer.After the deploy
Deployed with
(build): observability(288d4d260, run 43878530215, 2026-11-16 13:43Z). Grafana now serves the app dashboard with 74 panels: AP 80 and AP 81 are present, AP 45 is gone. On 2026-11-16, AP 24's commit rate reads 1.8926 tx/s forprod_docsplus, against 15.1000 tx/s for the whole cluster before the filter.HMarzban commentedon Nov 16, 2026
Measured, 2026-11-16: production after reads (a), (b), (c), (f), (g)
Read-only, production Prometheus and Grafana through the data-source proxy, 2026-11-16. Window: the 3 days to 2026-11-16 14:00Z, after the rule deploy of 2026-11-12. The before used 7 days; this window is 3 days, so compare shares, not totals. The 7-day read follows on or after 2026-11-19 (Left).
route!~"/health.*|/metrics". In the same window probes made 189,662.699 of 195,044.04 REST requests (97.2 %); the rules count the other 5,381.341slo-latency-p95-appminutes Firing, Grafana state historyhocuspocuscode-0 requests counted as errors in AP 3hocuspocuscode 0; the new expression counts 13.002, none of themhocuspocuscode 0app-performance.jsonwith a wrong valueprod_docsplus)Left
clamp_min(..., 1)on AP 3 and AP 14. Owner: maintainer..*mcp.*after Cut MCP write time on large pads and stop its four false alerts #726 ships. Owner: Cut MCP write time on large pads and stop its four false alerts #726.HMarzban commentedon Nov 16, 2026
Maintainer ruling, 2026-11-16
Answered by the maintainer in the 2026-11-16 working session; posted by the agent.
gt 1.5over 15 minutes; seed theGET /health/database503 series at 0).clamp_min(req/s, 1)on AP 3 and AP 14: keep as is.docs(changelog): record the v2.3.7 work of 2026-11-16
HMarzban commentedon Nov 16, 2026
Review, 2026-11-16 (maintainer approved).
HMarzban commentedon Nov 20, 2026
Measured, 2026-11-20: production 7-day after reads (a), (b), (c), (f)
Step 9. Read-only, production Prometheus and the Grafana API, on 2026-11-20. Method: Step 0, unchanged.
How this was read
up{job="rest-api"}has gaps between 07:56Z and 08:20Z.sum by (route) (increase(http_requests_total{job="rest-api"}[7d])), instant at 2026-11-20 00:00Z. The same query ran on each rule's own selector.for. Firing starts at the 11th breach in a row (for: 10m)./api/annotations?type=alertover the same window.sum by (service, code) (increase(traefik_service_requests_total{service=~"hocuspocus.*|rest-api.*"}[7d])), then the old and new AP 3 selectors.docsplus-app-performancedashboard were read first. Both match the repo: the rules carry the probe filter, and AP 3, 5, 33 and 34 (D) do not counthocuspocuscode 0.Before and after
slo-latency-p95-appminutes Firing, Grafana counthocuspocuscode-0 requests counted as errors in AP 3, 5, 33 and 34Split at the host move
hocuspocuscode-0 partThe new AP 3 pool is 1 more than the two parts. One
rest-api503 at Traefik fell in the 2 h of the move.Notes
/api/mcpmade 1,806.853 requests. The latency rule leaves them out.slo-latency-p95-mcpreads them./api/plugins/hypermultimedia/:documentIdtook between 30 s and 60 s (its histogram bucket) and returned 500. It is the only non-probe 5xx in the window (increase 1.001).for: 10mkept one error from paging.slo-latency-p95-mcpand the database-health rule had no state change in that time.Left
/api/plugins/hypermultimedia/:documentIdwas a slow upload cut by the edge proxy after 60 s. Filed as Let a media upload that takes longer than 60 s finish #803.HMarzban commentedon Nov 24, 2026
Closed, 2026-11-24
06f61ee44,288d4d260), 7 of 7promtoolcases, and 7-day afters (92.8 % -> 0 %, 100 % probe drop) are posted.2026-11-20because no real5xxoccurred.Closing #710 now. No action needed.