Observability: Prometheus, Grafana and the nightly load checks
SupaCloud exposes a single Prometheus /metrics endpoint, ships a ready-made
Grafana dashboard and alert-rule file, and runs a nightly real-backend load
check that gates p95 latency against a committed baseline. This page wires all
three so you can see request rate/errors/latency, DB-pool pressure and dispatch
health, and catch a performance regression before it reaches users.
Scrape /metrics with Prometheus
Section titled “Scrape /metrics with Prometheus”The server exposes GET /metrics on its root router (not under /api), so
it is outside the API auth stack; like every root route it sits behind the per-IP
governor rate limit (a scrape that carries the metrics bearer counts against the
read tier, a request without a credential against the strict tier). It renders
Prometheus text exposition (text/plain; version=0.0.4) and does DB + Docker
work per request, so do not scrape it more often than you need.
-
Set a metrics token (required in
MODE=prodand on any non-loopbackPUBLIC_URL):SUPACLOUD_METRICS_TOKEN=<a long random string>See the environment-variable reference for where your deployment reads env, and the OpenBao path under Use the OpenBao secret backend.
-
Point Prometheus at the server. The server listens on
SERVER_PORT(default8080). Add ascrape_config— with the bearer token:scrape_configs:- job_name: supacloud-servermetrics_path: /metricsscheme: http # https if you terminate TLS in front of the serverscrape_interval: 60s # each scrape does DB and Docker workscrape_timeout: 20s# Drop this block entirely if SUPACLOUD_METRICS_TOKEN is unset:authorization:type: Bearercredentials_file: /etc/prometheus/secrets/supacloud-metrics-tokenstatic_configs:- targets: ["supacloud.internal:8080"]Keep the token out of
prometheus.yml: write it to a file readable only by the Prometheus user and reference it withcredentials_file. Prometheus re-reads the file on every scrape, so a rotation needs no reload. Scrape the server over a private network (a VPN or tailnet address, or the container network) rather than through your public reverse proxy, and do not route/metricson the public hostname at all. -
Reload Prometheus and confirm the
supacloudtarget isUPon the Targets page, then check a series renders, e.g.supacloud_http_requests_total.
What the endpoint exposes
Section titled “What the endpoint exposes”RED — rate, errors, duration (per route)
Section titled “RED — rate, errors, duration (per route)”A middleware records every HTTP response under the matched Axum route
template (e.g. /api/runs/{id}/events), never the raw path — so the label
space is bounded by the route table plus a single {unmatched} fallback and
never grows with tenant ids or query strings. Three series carry the RED signal,
labelled by method, route and status:
| Metric | Type | Signal |
|---|---|---|
supacloud_http_route_requests_total |
counter | Rate — requests served |
supacloud_http_route_errors_total |
counter | Errors — responses with status ≥ 500 |
supacloud_http_route_duration_seconds |
histogram | Duration — latency buckets (_bucket/_sum/_count) |
The duration histogram uses fixed le buckets from 5 ms to 60 s, so
histogram_quantile() gives you a real p95 per route. Process-wide counters
(supacloud_http_requests_total, supacloud_management_requests_total,
supacloud_webhook_requests_total, supacloud_task_launch_requests_total,
supacloud_scheduler_ticks_total) and business gauges
(supacloud_tasks_total{status}, supacloud_ai_cost_month_usd,
supacloud_agent_containers_active) round out the snapshot.
supacloud_tasks_total{status} counts every task row by its current status since the
instance began: it is an all-time gauge, not a rate, so a failure ratio built on it
mixes years-old rows into today. For recent behaviour use the counter
supacloud_task_transitions_total{status}, the task status transitions this process
persisted, and read it through increase() over a window. The gauge
supacloud_task_transitions_recent{status,window="24h"} counts the tasks whose last
transition falls inside the last 24 hours, read from the database, so it survives a
restart and spans replicas.
supacloud_artifact_form_draft_saves_total counts the draft saves of artifact page
forms that wrote a row, per process. A draft save writes no audit row and no live
signal, because it fires every few seconds while a person types, so this counter is
the measurement of autosave load. Read it through rate().
supacloud_db_runtime_role_privileged is the posture of the database role the server
connects as: 1 when it is SUPERUSER or BYPASSRLS, 0 when it is neither, -1 when
the check could not run. A MODE=prod server refuses to boot on 1, and the shipped
rule SupaCloudDbRuntimeRolePrivileged pages (critical) on it.
supacloud_db_runtime_role_owner is the same check’s ownership finding: 1 when the
runtime role owns the schema or its tables, or can become their owner, 0 when it
holds DML grants only, -1 when the check could not run. The server boots either way
and logs a WARN; the shipped rule SupaCloudDbRuntimeRoleOwner warns after 15 minutes
on 1.
DB pool saturation
Section titled “DB pool saturation”The PostgreSQL connection pool is exported so you can see pool pressure before it turns into request latency:
| Metric | Type | Signal |
|---|---|---|
supacloud_db_pool_connections{state="active|idle|open"} |
gauge | Connections by state |
supacloud_db_pool_max_connections |
gauge | Configured pool maximum |
supacloud_db_pool_saturation |
gauge | active / max ratio (0–1) |
supacloud_events_rows |
gauge | Live row estimate of the events table |
supacloud_events_table_bytes |
gauge | Total events size incl. indexes and TOAST |
A supacloud_db_pool_saturation riding near 1.0 means requests are queueing on
the pool — scale the pool or shed load.
The wait itself is sampled: once per minute every replica times one connection
acquire from its request pool into the histogram
supacloud_db_pool_acquire_probe_seconds, and counts a probe that got no
connection in supacloud_db_pool_acquire_probe_failures_total. A p95 of that
histogram in seconds is what a request waits on a full pool. The same probe, and every
GET /readyz/deps, sets supacloud_dependency_up{dependency="database"} to 1 or 0
and supacloud_dependency_last_check_timestamp_seconds to the time of that check.
/readyz itself never asks the database, so this gauge is where a replica’s database
verdict shows up.
Every scrape of /metrics checks the database as well, with a two-second ping and a
six-second limit on its queries. When the database does not answer, the scrape still
returns 200: the process series (requests, pool, launch phases and the rest) render,
supacloud_dependency_up{dependency="database"} reads 0, the series that come from the
database (task counts, month spend, backlog, runners and similar) are left out of that
scrape, and supacloud_metric_input_available reads 0 for each of their inputs. A
database outage therefore pages on the gauge, not as a scrape target that went down.
The pool’s own limits are configurable, and all four have safe defaults:
| Variable | Default | Effect |
|---|---|---|
SUPACLOUD_DB_MAX_CONNECTIONS |
10 |
Pool ceiling. Both Blockworx stacks set 30. |
SUPACLOUD_DB_ACQUIRE_TIMEOUT_SECS |
5 |
How long a request waits for a connection before it answers 503 with Retry-After. |
SUPACLOUD_DB_STATEMENT_TIMEOUT_MS |
15000 |
Server-side per-statement ceiling. 0 disables it. Migrations run on a separate connection with no ceiling. |
SUPACLOUD_DB_IDLE_IN_TRANSACTION_TIMEOUT_MS |
30000 |
Cuts an abandoned open transaction. 0 disables it. |
events growth and retention
Section titled “events growth and retention”events holds one row per streamed delta, container log line and tool call, so it is
the largest table in the schema. Watch supacloud_events_table_bytes — the row count
is pg_stat_user_tables.n_live_tup, an estimate, because an exact count would mean a
full scan on every scrape.
A daily sweep (one replica per cadence, elected through background_leases) deletes
the debug volume of finished runs: container_log and agent_thinking rows older
than SUPACLOUD_EVENT_RETENTION_DAYS (default 30) whose run is terminal. Agent
transcripts (agent_message, delta and full-text echo), tool calls
(agent_tool_use), terminal events and cost events are never pruned. An
override is bounded to 1-3650 days; any other value falls back to 30 with a warning.
Both gauges are readable on the container’s own /metrics. Alerting on them needs a
Prometheus scrape job for SupaCloud first.
Slow-query signal (logs, not a metric)
Section titled “Slow-query signal (logs, not a metric)”Slow statements surface in the server logs, not on /metrics. The pool is
configured to log any statement slower than a threshold at WARN level via
sqlx’s slow-statement logging. The threshold is SUPACLOUD_SLOW_QUERY_LOG_MS
(default 250 ms; a zero or unparseable value falls back to 250). Grep the
server log for these WARN lines, or ship the logs to Loki, to find the queries
behind a route p95 spike.
Background pass duration
Section titled “Background pass duration”supacloud_background_arm_pass_seconds{seat} is a histogram of how long each
completed pass of an instance-wide background job took. seat names the job
(operability_alerts, backlog_sweep, …); a seat appears after its first pass on
this replica. A pass that keeps growing toward its period is the early sign of a
job that will start overlapping itself:
histogram_quantile(0.95, sum by (seat, le) (rate(supacloud_background_arm_pass_seconds_bucket[30m])))Browser WebSocket churn
Section titled “Browser WebSocket churn”supacloud_ws_connections_total counts the browser WebSocket connections upgraded
since boot; supacloud_ws_connections_active is the number open now. A reconnect
storm is a high rate(supacloud_ws_connections_total[5m]) while the active gauge
stays flat.
Dispatch operability + alert state
Section titled “Dispatch operability + alert state”The delivery engine’s health is exported so the same Prometheus can alert on a stalled scheduler or a growing backlog (the human-facing view of this lives in Operate the Delivery Engine):
| Metric | Type | Signal |
|---|---|---|
supacloud_scheduler_seconds_since_tick |
gauge | Seconds since the last scheduler tick (-1 before the first tick) |
supacloud_backlog_queued_items{enabled="true"} |
gauge | Queued items of projects that can dispatch (backlog arm on, not archived, owner present) |
supacloud_backlog_queued_items{enabled="false"} |
gauge | Parked queued items: the backlog arm is off, the project is archived, or its owner is gone. They never dispatch and never raise queue_age |
supacloud_backlog_oldest_queued_age_seconds |
gauge | Age of the oldest dispatchable queued item (parked items are not counted) |
supacloud_backlog_items_open_with_closed_source |
gauge | Pre-dispatch items whose issue is closed or left the open listing unconfirmed (healthy: 0) |
supacloud_forge_delivery_intents_abandoned |
gauge | Verified forge deliveries whose durable effect ran out of retries (healthy: 0) |
supacloud_backlog_orphaned_in_progress |
gauge | Items still in_progress on a completed, failed or skipped run, untouched for 4 h, counted before each recovery pass (healthy: 0) |
supacloud_dispatch_alert{kind="…"} |
gauge | Evaluated alert state per kind (1 = breaching, 0 = ok) |
supacloud_platform_key_headroom{key="…"} |
gauge | Remaining share (0-1) of each instance-level provider key shared by every tenant; one series per key |
supacloud_storage_capacity_refusals_total |
counter | Storage requests the provider refused because its own byte or egress cap is spent (healthy: flat) |
The supacloud_dispatch_alert kinds (tick_sla, queue_age, error_spike,
budget_80, weekly_window_low, platform_key_low) are evaluated server-side
against named-const thresholds, so the gauge already tells you whether a rule is
breaching — you do not have to re-derive the thresholds in PromQL. queue_age and
supacloud_backlog_oldest_queued_age_seconds count dispatchable items only, so a
project whose backlog arm is off can hold queued items forever without paging. Select
supacloud_backlog_queued_items{enabled="true"} in your own queries; the bare metric
name returns both series.
The platform-key readings are the rate-limit headers of traffic the instance key already
served — no probe, no model token. Every replica persists what it observed into
platform_key_readings (instance-wide, no tenant data), so the platform_key_low kind pages
from whichever replica holds the metrics seat: that is the D9 80 % line (0.20 remaining).
The per-instance supacloud_platform_key_headroom{key} series names the key and carries the
D9 95 % line (0.05 remaining) as a critical page; a key this replica never served has no
series there.
error_spike is a recent rate, not a count over the instance’s history. It reads the
tasks that reached a terminal status (completed, failed, cancelled,
interrupted) in the last 24 hours and breaches when more than 25 % of them are
failed, once at least 20 tasks ended in that window. Failures older than 24 hours
neither raise the alert nor hold it up, and a task that is still pending, running or
waiting is not part of the sample. The sample is visible on
supacloud_task_transitions_recent{status,window="24h"}: add up the four terminal
statuses for the total and read status="failed" for the failures.
The alert states are evaluated by the 60-second operability lane, which also sends each rising edge to the error sink (GlitchTip) once per fleet, whether or not anything scrapes (see Autonomous-loop SLIs).
Backlog intake failures are counted per issue provider:
supacloud_backlog_scan_failures_total{provider, reason} (counter; reason is auth when
the project’s issue credential is missing or refused, error for anything else). A failing
project is backed off — the next attempt doubles from 5 minutes up to 6 hours (auth) or
1 hour (error) — and the workspace owner is notified once per credential episode.
When the dispatch env builder strips a hub-master secret name (such as DATABASE_URL)
from an agent environment, it counts
supacloud_dispatch_secret_stripped_total{name, layer} (counter; layer is
capability, project-mcp or dispatch_payload) and logs an ERROR line naming the
layer and resource, never the value. The secret never reaches the agent; healthy is 0.
Autonomous-loop SLIs
Section titled “Autonomous-loop SLIs”The delivery loop itself (backlog, merge gate, runner fleet, agent launch) has its own series:
| Metric | Type | Signal |
|---|---|---|
supacloud_backlog_items{state} |
gauge | Backlog items per state (zero-filled for every known state) |
supacloud_gate_pending{phase} |
gauge | Merge-gate items waiting per gate phase |
supacloud_gate_oldest_age_seconds{phase} |
gauge | Age of the oldest item in each gate phase |
supacloud_gate_verdicts_24h{gate, verdict} |
gauge | Merge Gate Ledger verdicts written in the last 24 h (invalidated rows excluded) |
supacloud_merges_24h |
gauge | Backlog items closed (merged) in the last 24 h |
supacloud_merge_latency_seconds{quantile} |
gauge | Audit pass to merge, p50 and p95, over items closed in the last 7 days |
supacloud_last_merge_age_seconds |
gauge | Seconds since the last backlog item was closed |
supacloud_runners{status} |
gauge | Registered runners per status (pending, online, offline, disabled) |
supacloud_runner_work_unclaimed |
gauge | Runner work assignments not yet claimed |
supacloud_runner_work_oldest_unclaimed_age_seconds |
gauge | Age of the oldest unclaimed runner work assignment |
supacloud_runner_claim_latency_seconds{quantile} |
gauge | Assignment to claim, p50 and p95, over the last 24 h |
supacloud_operability_snapshot_age_seconds |
gauge | Age of the cached operability snapshot the scrape served |
supacloud_agent_launch_phase_seconds{phase} |
histogram | Agent launch phases: image_select, image_pull, image_check, prepare, container_start, and total for a whole successful launch |
These gauges are computed by a 60-second background lane from the database and
served from its cache, so a scrape adds no query for them;
supacloud_operability_snapshot_age_seconds shows how fresh they are.
supacloud_runner_oldest_online_heartbeat_age_seconds is the age of the oldest
last heartbeat among the runners marked online; it has no sample while no
runner is online. A value that climbs towards the liveness cut-off names a runner
that is about to be taken offline.
An agent launch placed on the hub returns once it is admitted and placed: the
image pull, the container start and the bridge run after the request has
answered, so image_pull no longer adds to the launch request’s latency. A pull
that fails marks the run failed with the image reason.
An agent run’s runs.started_at is its container start, so run durations
exclude image pull and preparation; those appear in
supacloud_agent_launch_phase_seconds. A run opened while an HTTP request is
served carries that request’s x-request-id as trigger_context.request_id,
so the log line, the response header and the run join up.
Wire the Grafana dashboard and alert rules
Section titled “Wire the Grafana dashboard and alert rules”Both artifacts are committed in the repo under observability/ — import them
as-is.
-
Import the dashboard. In Grafana, Dashboards → New → Import, and upload
observability/grafana/supacloud-s4-dashboard.json. Pick your Prometheus datasource when prompted (the dashboard exposes adatasourcetemplate variable). It ships seventeen panels, and ahostvariable that narrows every panel to one scrape target (all targets by default; a self-hosted instance without ahostlabel shows everything):- HTTP Route p95, HTTP Route Throughput, HTTP Route 5xx (per
host) - DB Pool Saturation, Dispatch SLA + Queue
- Backlog items by state, Gate pending by phase, Gate oldest age by phase, Ledger verdicts (24h)
- Merge latency, Merges (24h)
- Runners by status, Runner work and claim latency
- Agent launch phase p95, Dispatch alerts
- Scheduler lane duration, Hub lag and relay drops
- HTTP Route p95, HTTP Route Throughput, HTTP Route 5xx (per
-
Load the alert rules.
observability/prometheus/supacloud-s4-rules.ymlis a Prometheus rule group. Reference it from yourprometheus.yml(rule_files:) or load it into Grafana-managed alerting. It defines 38 rules:Alert Fires when Severity SupaCloudHttpRouteP95Higha route’s p95 > 2 s for 15 m, per target ( instance,host)warning SupaCloudHttpRouteErrorssustained 5xx rate > 0.05/s for 10 m, per target ( instance,host)warning SupaCloudDbPoolSaturationsupacloud_db_pool_saturation> 0.85 for 10 mwarning SupaCloudDispatchTickSlasupacloud_dispatch_alert{kind="tick_sla"} == 1for 5 mcritical SupaCloudDispatchQueueAgesupacloud_dispatch_alert{kind="queue_age"} == 1for 15 mwarning SupaCloudDispatchErrorSpikesupacloud_dispatch_alert{kind="error_spike"} == 1for 15 mwarning SupaCloudDispatchBudget80supacloud_dispatch_alert{kind="budget_80"} == 1for 5 mwarning SupaCloudDispatchWeeklyWindowLowsupacloud_dispatch_alert{kind="weekly_window_low"} == 1for 15 mwarning SupaCloudPlatformKeyLowsupacloud_dispatch_alert{kind="platform_key_low"} == 1for 15 mwarning SupaCloudPlatformKeyCriticalmin by (key) (supacloud_platform_key_headroom) <= 0.05for 5 m, perkeycritical SupaCloudStorageCapacityRefusedsupacloud_storage_capacity_refusals_totalrose in the last hour, for 5 mwarning SupaCloudTierChainEmptysupacloud_dispatch_alert{kind="tier_chain_empty"} == 1for 1 hwarning SupaCloudUsageReaderBrokensupacloud_dispatch_alert{kind="usage_reader_broken"} == 1for 30 mwarning SupaCloudSchedulerTicksAbsentno supacloud_scheduler_ticks_totalseries for 10 mcritical SupaCloudSchedulerLaneStalleda lane’s supacloud_scheduler_lane_busy_seconds> 2 × itssupacloud_scheduler_lane_cadence_secondsfor 10 mcritical SupaCloudBacklogItemsOpenWithClosedSourcesupacloud_backlog_items_open_with_closed_source> 0 for 1 hwarning SupaCloudForgeDeliveryIntentAbandonedsupacloud_forge_delivery_intents_abandoned> 0warning SupaCloudBacklogOrphanedInProgresssupacloud_backlog_orphaned_in_progress> 0 for 1 hwarning SupaCloudBacklogScanAuthFailingmore than 3 refused backlog scans per provider in 1 h warning SupaCloudHubConsumerLosingEventsa hub consumer dropped events ( supacloud_hub_lagged_events_totalrose) for 10 mwarning SupaCloudHubRelayDroppingEventsthe cross-replica hub relay dropped events ( supacloud_hub_relay_dropped_totalrose) for 10 mwarning SupaCloudRealtimeControlStucka realtime control failed in every 5 m window ( rt_control_failures_totalrose) for 30 m, peropandclasscritical SupaCloudRealtimeRelayRefuseda permanent relay refusal was kept pending for retry ( supacloud_realtime_relay_refused_totalrose)warning SupaCloudDispatchSecretStrippedsupacloud_dispatch_secret_stripped_totalrose in the last 1 hwarning SupaCloudMetricsMissingno job="supacloud-server"target is up for 15 mcritical SupaCloudGateStalledthe oldest item in ci_pending,awaiting_review,awaiting_visualormerge_retrywaits > 4 h for 15 mwarning SupaCloudGateAwaitingHumanLongthe oldest item in awaiting_human_statuswaits > 24 h for 15 mwarning SupaCloudMergeBlockedany item in gate phase merge_failedorblockedfor 1 hwarning SupaCloudMergeLatencyP95Highaudit pass to merge p95 (last 7 days) > 6 h for 1 h warning SupaCloudRunnerWorkUnclaimedthe oldest unclaimed runner assignment > 15 m for 5 m warning SupaCloudRunnersAllOfflinerunners are registered but none is online for 12 h, per target warning SupaCloudAgentLaunchSlowp95 of the whole agent launch ( phase="total") > 60 s over 30 m, for 30 mwarning SupaCloudOperabilityLaneStalesupacloud_operability_snapshot_age_seconds> 300 for 5 mwarning SupaCloudInvariantBreachsupacloud_invariant_breach_totalrose in the last 15 m, perkindwarning SupaCloudTaskFailureRatioHighmore than half of the task transitions in the last 24 h ended failed, per target, for 30 mwarning SupaCloudModelSelectionCoverageLowfewer than 95 % of the tasks created in the last 24 h recorded a model selection, for 1 h warning SupaCloudDbRuntimeRolePrivilegedsupacloud_db_runtime_role_privileged == 1: the runtime database role is SUPERUSER or BYPASSRLScritical SupaCloudDbRuntimeRoleOwnersupacloud_db_runtime_role_owner == 1for 15 m: the runtime database role owns the schema or its tableswarning Every
supacloud_dispatch_alertkind has exactly one rule; a server test fails when a kind is added without one. If you run several SupaCloud servers, also add an absence rule per target (for exampleabsent(up{job="supacloud-server", instance="…"})): a bareabsent()only fires when every target is gone.observability/prometheus/supacloud-s4-rules.test.ymlholds the promtool unit tests for these rules; run them withpromtool test rules observability/prometheus/supacloud-s4-rules.test.yml. A*.test.ymlfile is a test, not a rule file: do not list it inrule_files. -
Load the log rules (Loki).
observability/loki/supacloud-server-log-rules.ymlis a Loki ruler rule group over thesupacloud-servercontainer logs. Load it into the Loki ruler or into Grafana-managed alerting with a Loki data source; it is LogQL, so it does not belong in Prometheusrule_files.Alert Fires when Severity SupaCloudLogPathDominatesone request route (the matched template, read from the request span’s routefield in text and JSON logs) is more than 50 % of the server’s log lines over 1 h, perhostwarning SupaCloudServerErrorRateHighmore than 20 ERROR lines per hour, per host, for 30 mwarning -
Attach a contact point. Route the
severity/stream: s4labels to your on-call channel so the critical tick-SLA alert pages and the warnings notify.
The E2E + k6 load checks
Section titled “The E2E + k6 load checks”The manual qualification workflow (.forgejo/workflows/e2e-nightly.yml, via
workflow_dispatch) boots a real backend stack — server, Postgres, web —,
seeds it, and runs three checks against it. Its predominantly red recurring
schedule is disabled until the lane is repaired and has a reviewed green run:
- Playwright real-backend E2E (
npm run test:e2e:nightly) drives the UI against the live server, not mocks. - k6 hot-endpoint budgets (
scripts/perf/run-k6-nightly.sh→k6/s4-hot-endpoints.js) load the six hottest read paths and gate their p95. - k6 2.0 WebSocket streaming (
scripts/perf/run-k6-streaming.sh→k6/s4-ws-streaming.ts) authenticates against the real server, receives live task events throughk6/websockets, and records sequence gaps, server resync frames and exact-after_sequencerecovery as custom metrics.
The k6 scenarios cover the boards and the two hot non-board paths:
tasks_board, projects_board, runs_board, run_events, dispatch_tick
(/api/operator/v1/dispatch/metrics) and mcp_gateway (a tools/list call to
/api/mcp). Each runs at K6_VUS virtual users for K6_DURATION (the nightly
uses 4 VUs for 2 m).
The p95 budget gate
Section titled “The p95 budget gate”Each scenario writes a k6 summary that scripts/perf/check-k6-budget.mjs
compares against the committed governed baseline in k6/baselines/:
- With
K6_REQUIRE_BASELINE=1(the nightly default) a missing or non-positive baseline p95 fails the job — the gate is real from day one. - The H4 manifest is validated on every run. While it is
pending, the existing reviewed single bootstrap file is used. Onceactive, only the three checksum-pinned samples are accepted and their per-metric median is used; an invalid set never falls back to the single file. - A scenario whose p95 regresses by more than 20% over its governed baseline
fails the job.
PERF_P95_REGRESSION_PCTis retained as an explicit workflow declaration, but any value other than20now fails closed. - Each k6 scenario also carries an absolute in-script p95 ceiling (e.g.
tasks_boardat 1200 ms,runs_boardat 1500 ms) and an error-rate threshold of< 1%; breaching either fails k6 directly.
When pg_stat_statements is available the runner also records the DB-call delta
per scenario and writes a db_queries_per_request figure into the budget
report, so a query-count regression (an N+1 creeping in) is visible alongside
latency. Artifacts (k6 summaries, server/Postgres/web logs, the Playwright
report) are uploaded on every run, and a failure posts to the S4_FAILURE_WEBHOOK
if configured.
Two independent, manually dispatched lanes exercise longer-lived failure modes
without joining the deploy graph. soak-weekly.yml runs 90 minutes and gates the linear slope
(after a ten-minute burn-in) of server RSS, open file descriptors, PostgreSQL
connections and the durable scheduler_tick_durations signal. It deliberately
does not infer a leak from one absolute snapshot. chaos-weekly.yml places
Toxiproxy in front of PostgreSQL and WebSocket traffic, then runs five bounded
experiments: proxy latency, Pumba pause, Pumba netem, Pumba kill/restart and a
PostgreSQL restart. Health, a DB query, an authenticated API read and a real WS
event stream must all recover after every experiment.
These lanes require the self-hosted e2e-host-net runner’s Docker socket and
network-emulation privileges. Tool versions are fail-closed (k6 2.0.0,
Toxiproxy 2.12.0, Pumba 1.1.7; the nettools helper is digest-pinned), and main
dispatches require the exact server SHA image. Recurring soak/chaos activation is
gated on each lane’s first reviewed green run. The confirmed H4 governance records all
three successful raw sample sets side by side with immutable provenance,
checksums and review metadata, then computes the deterministic per-metric median
at gate time. All three runs must have distinct identities and content but the
same exact SHA and declared environment. Nightly captures evidence only; it
never curates or updates a committed baseline. The existing reviewed single
baseline and unchanged 20% p95 threshold remain authoritative while the
committed H4 manifest is pending.
CI trend store
Section titled “CI trend store”Three Grafana dashboards read the dedicated CI trend database ci_trends:
SupaCloud Playwright flake trend, mutation score and risk coverage. The
database is neither the SupaCloud product database nor Forgejo’s, and it holds no
application migration. Infrastructure provisions the database, the roles and the
dashboards; the repository secret TREND_DB_DSN carries the ingest connection.
The ingest role creates every relation itself, idempotently, on each run:
| Relation | Producer on main |
What the dashboard shows |
|---|---|---|
ci_playwright_trend |
e2e-nightly, smoke-e2e and mock-e2e-full, one row per test attempt |
Flake rate, p95 duration drift, error-signature clusters |
ci_mutation_score_trend |
None. The mutation lanes are parked (#791) | No data. An empty panel here is not a healthy mutation score |
ci_risk_coverage_runs |
None. The scenario-risk lane is parked (#791) | No data. An empty panel here is not healthy coverage |
scripts/ci/ci-trend-ingest.mjs runs as one step inside each of the three jobs in
e2e-nightly.yml, after the Playwright gate and also when that gate is red. Its
source is the nightly receipt in web/test-results/, which keeps every retry
attempt, so a failed first attempt followed by a pass stays visible; JUnit collapses
that case to a pass. Error text is never stored, only the SHA-256 of its first line.
A run counts as a flake only when an earlier attempt failed, timed out or was
interrupted and its final attempt passed.
The store never gates. The step exits 0, warns with ::warning title=ci-trend:: and
keeps its real outcome in web/test-results/ci-trend-ingest.json, published with
the nightly artifacts:
exit_code |
Meaning |
|---|---|
0 |
Rows stored, parity holds, every dashboard query ran |
2 |
Bad invocation, or the run has no repository, run ID or source SHA. Nothing was stored |
3 |
The store is unreachable or the pg client is missing |
4 |
The write failed and rolled back |
5 |
Row parity failed: the rows stored differ from the count the receipt claims |
6 |
The receipt is absent or unusable. The ledger still records the run as no_source |
7 |
A configured dashboard query failed. dashboards[] in the record names it and its SQLSTATE |
8 |
TREND_DB_DSN is unset |
9 |
The store stopped answering and the watchdog ended the step |
Read freshness and parity
Section titled “Read freshness and parity”Every run writes one row per relation into ci_trend_ingest_runs: the source SHA,
the status (ok, partial, no_source, no_producer, parity_mismatch), the row
counts of the receipt and of the table, the gate’s own exit and ingested_at. A
relation without a producer appears as no_producer on every run. Query the latest
state per lane from the same datasource:
SELECT DISTINCT ON (relation, lane) relation, lane, status, source_rows, stored_rows, gate_exit, run_sha, ingested_at, now() - ingested_at AS ageFROM ci_trend_ingest_runsWHERE repository = 'blockworx/supacloud'ORDER BY relation, lane, ingested_at DESC;The nightly runs daily, so an ingested_at older than 36 hours means the writer
stopped, whatever the trend panels draw. stored_rows equals source_rows on every
healthy row. A red nightly with gate_exit other than 0 is still a valid trend row.
Quarantine governance
Section titled “Quarantine governance”-
Keep quarantine exceptional.
web/tests/e2e/quarantine.jsonis normally empty. A temporary entry must match an explicit@quarantinetest-title tag and carryowner,reasonand an expiring UTCreview_by. The validate job rejects stale IDs, expired entries and tag/list drift. PR/main lanes exclude only that explicit tag; the nightly quarantine lanes run tagged mock and real tests five times with retries disabled. -
Read the changed-spec burn-in separately. Nightly changed mock and real specs run ten times on
chromium-desktopwith retries disabled. The lastci-green/web-lintmarker is the preferred diff anchor, with the commit from 24 hours ago as fallback. If the diff cannot be computed, the lane runs the full applicable suite instead of silently skipping it.
Troubleshooting
Section titled “Troubleshooting”| Symptom | Likely cause | What to check |
|---|---|---|
Prometheus target is DOWN with 401 |
SUPACLOUD_METRICS_TOKEN set but the scrape config has the wrong/no bearer token |
The file named by authorization.credentials_file holds exactly the env value |
/metrics is publicly readable |
Local dev instance on a loopback PUBLIC_URL with no token (only case the server allows) |
Set SUPACLOUD_METRICS_TOKEN and mirror it in the scrape config |
| Route p95 panel is flat / empty | No traffic yet, or you queried a raw path | Series are labelled by the route template; check supacloud_http_route_duration_seconds_bucket exists |
| A route is slow but the cause is opaque | The slow query is in the logs, not on /metrics |
Grep the server log for WARN slow-statement lines; lower SUPACLOUD_SLOW_QUERY_LOG_MS to widen the net |
Requests answer 503 with Retry-After |
The pool handed out no connection inside SUPACLOUD_DB_ACQUIRE_TIMEOUT_SECS |
supacloud_db_pool_saturation; then the host (a frozen host produces exactly this) before raising SUPACLOUD_DB_MAX_CONNECTIONS |
events keeps growing |
The window is long, or the volume is transcripts rather than logs | SUPACLOUD_EVENT_RETENTION_DAYS (a WARN on boot names a rejected override); then event_type shares — only container_log and agent_thinking are pruned |
SupaCloudDispatchTickSla is firing |
Scheduler/dispatch tick has not advanced inside the SLA window | supacloud_scheduler_seconds_since_tick; see Operate the Delivery Engine |
SupaCloudBacklogItemsOpenWithClosedSource is firing |
The intake cannot reconcile a backlog item with its issue: the forge is refusing single-issue reads, the scan is failing, or the issue was deleted and the second complete listing has not run yet | issue_missing_since / issue_checked_at on the items the alert’s SQL lists; the server log for backlog scan WARN lines (a 404 listing means a renamed repository or a disabled tracker) |
SupaCloudBacklogOrphanedInProgress is firing |
Backlog items sit in_progress on a run that already ended, and the recovery lane that runs on every 300 s backlog tick has not released them: the lane is not running, or its repair keeps failing |
The server log for backlog recovery: lines (projects, recovered, orphaned) and the per-project backlog dispatch: recovered lines (recovered, blocked: items blocked by a policy-skip verdict or by three failed recoveries in a row); SupaCloudSchedulerLaneStalled for the backlog lane; the alert’s SQL lists the items |
SupaCloudMetricsMissing is firing |
The scrape job is missing, every target is down, or the bearer token is wrong | Prometheus Targets page for job="supacloud-server"; a 401 there means the credentials file and SUPACLOUD_METRICS_TOKEN differ |
SupaCloudBacklogScanAuthFailing is firing |
A project’s issue credential is missing or refused, so its backlog stopped ingesting | SELECT * FROM backlog_scan_health WHERE reason = 'auth' names the project; fix its issue credential, then run an apply scan to clear the backoff at once |
| Nightly fails on baseline governance | While H4 is pending, a k6/baselines/<scenario>.summary.json is absent/non-positive; when active, the manifest, provenance, review, checksum or three-sample contract is invalid |
Pending: restore the reviewed single file. Active: run k6-baseline-governance.mjs validate; fix and review the evidence set rather than falling back |
| A CI trend dashboard shows no data | Flake dashboard: the ingest step warned, or the last nightly was not a recent one. Mutation and risk dashboards: no producer runs on main, so No data is the honest state |
The ci-trend warning and web/test-results/ci-trend-ingest.json of the last nightly (exit_code, dashboards[]); ci_trend_ingest_runs for status and ingested_at |
Validate rejects quarantine.json |
Entry expired, test ID disappeared, inventory changed, or tag/list no longer agree | Regenerate web/tests/e2e/test-inventory.json, then remove the quarantine or update its bounded owner review |