~ knotless Search/
↑↓ move↵ open⇧↵ all results

zat.dev/stream

jetstream v2 in zig · mirror of https://tangled.org/zat.dev/stream

0
0
98 lines · 5.4 KB Raw History
---
name: production-health
description: Check Stream production health, recent ingest and delivery behavior, host capacity, and monitoring using the repository's read-only recipes.
---

# Stream production health

Run from the Stream repository. Read `docs/deploying.md` for operational
semantics and `deploy/prometheus/rules.yml` for alert thresholds. This skill
checks production; deployment remains the separate documented admission path.

## First pass

Run `just prod-health`. It returns JSON with public status/build, container
identity and restarts, host capacity, active alerts and scrape targets, current
ingest, 24-hour rate/RSS summaries, and recent error/maintenance increments.
It uses curl and SSH, requires uv and `~/.ssh/waow_ed25519`, and changes no
production state. Nonzero exit means a check failed to execute; a zero exit
means observations were collected, not that every observation is healthy.
Empty vectors are missing evidence, not zero errors. Inspect the `errors` field.

Compare a second observation after other checks to establish upstream and local
archive progress. Report the observed interval and distinguish current state,
last-hour behavior, and the prior 24 hours (which may span deployments).

- Match `stream_build_info` and the running image digest to the release receipt.
  Main can contain later documentation/site commits than the production binary.
- `/status` saying `live` is not evidence of ingest or subscriber delivery.
  Its upstream sequence and durable cursor belong to different sequence spaces:
  the displayed durable cursor is the local archive sequence. Do not subtract
  them to calculate loss or lag.
- Prometheus `up` describes successful scrapes, not uninterrupted event delivery.
  Event age includes scrape delay. The stats site's historical chart measures
  relay-eval's `bsky.network`, not Stream output or necessarily its upstream.
- Examine queue drops, reconnects, decode/encode errors, ingest-drop reasons,
  pending repairs, and maintenance outcomes. Filtered/oversize subscriber events
  are not automatically lost ingest. A failed-repository count alone does not
  establish a new regression; compare history and retry outcomes.
- Restart resets compaction and retry timers. No pass in a newly started process
  may be expected; consult configuration and prior history before diagnosing it.
  The retry-pass counter increments at pass entry, not completion; use logs to
  establish completion. Prometheus `increase` estimates can be fractional.
- Check available memory, RSS trend, disk and inode headroom, restart/OOM state.
  Low free memory with available page cache is not itself exhaustion.

## Delivery

Run sequentially, one connection each:

```sh
just prod-delivery
just prod-delivery 10
```

Each runs a 60-second public WebSocket probe from the production cloud host,
with one-second reports. Inspect message deltas, errors, disconnects and the
final line; the loadgen's exit code alone does not assert successful delivery.
The first report initializes rate tracking and can say `0/s` despite a positive
cumulative message count; compare subsequent counts to find actual silent periods.
Live and rewind exercise different paths. An initially empty interval during
connection establishment differs from a stall after delivery starts. These
samples establish delivery during the probe, not full historical continuity.

The recipe expects `/tmp/stream-loadgen` on the host. If absent, rebuild and
transfer it using the baseline Linux target in `docs/build-targets.md`; never
copy a CPU-native HeavyPad binary. Do not install anything or restart Stream
merely because a probe dependency is missing. No firehose subscriptions on the
workstation or HeavyPad, which share the home network.

## Follow-up checks

SSH uses `ssh -i ~/.ssh/waow_ed25519 -o IdentitiesOnly=yes
-o BatchMode=yes -o ConnectTimeout=5 root@89.167.122.160`.
Compose lives at `/opt/stream-experiment`.

- Recent logs: `docker logs --since 1h --tail 100 stream-experiment-stream-1`.
  Inspect bounded output and redact credentials/identifying request data before
  sharing it. Do not dump container environment, compose config, or `.env`.
- For unexplained trends, query Prometheus inside its container using
  `docker exec stream-experiment-prometheus-1 wget -T 5 -qO- URL`, with URL
  `http://127.0.0.1:9090/api/v1/query?query=...` (URL-encode PromQL).
  Use range queries for timing/correlation when min/max summaries are insufficient.
- Monitoring delivery: check Alertmanager notification failure metrics, not
  just the absence of active alerts. Routing is documented in `deploy/README.md`.
- If reviewing maintenance/security state, verify `uname -r`, host and container
  `net.mptcp.enabled`, and `systemctl is-active stream-tcp-options-guard` against
  `docs/releases/0.0.2.md`. Mitigations do not prove a kernel is patched; verify
  the current Ubuntu advisory before making a patch-status claim.

Public `/healthz` is not the canonical health route through Caddy; use `/status`
and `/metrics`. Internal debug health endpoints are documented in deploy/README.md.
Do not restart, reload, bounce consumers, change relay, or deploy as a diagnostic
shortcut. `just site`, `just caddy`, `just admit`, and `just publish-docker` are
mutating workflows, not health checks.

Summarize findings, evidence windows, and outstanding concerns. Do not infer
that consumers remained connected across a deployment from current listener
counts. Preserve material findings in project docs, not in this reusable skill.