docs and option text: describe the sender stamp, drop the hive label
This commit is contained in:
parent
c529bab9ea
commit
ea84d746dd
3 changed files with 69 additions and 51 deletions
|
|
@ -129,25 +129,29 @@ carries a credential:
|
|||
|
||||
- **agent→collector** (this section's hop) stays open on the bridge. Nothing
|
||||
downstream can tell one agent's export from another's.
|
||||
- **hive→swarm** authenticates. The swarm tier gives each hive its own receiver
|
||||
and stamps `hive=` from whichever one accepted the sample, so _that_ label is
|
||||
unforgeable — see [Authenticated ingest](#authenticated-ingest) below.
|
||||
- **hive→swarm** authenticates. Every authenticated receiver feeds the same
|
||||
pipelines, which stamp `sender` with the token's client id, so _that_ label
|
||||
is unforgeable — see [Authenticated ingest](#authenticated-ingest) below.
|
||||
|
||||
A verified `hive` is reachable and a verified `agent` isn't — and that falls
|
||||
out of the topology rather than being a gap someone forgot to close. The swarm
|
||||
runs one collector, and the mechanism gives it no finer grain: a bearer-token
|
||||
check never reveals _which_ token matched, and a receiver reads request metadata
|
||||
rather than the claims it authenticated with.
|
||||
A verified `sender` is reachable and a verified `agent` isn't — and that falls
|
||||
out of the topology rather than being a gap someone forgot to close. Agents
|
||||
export to their hive's collector without a credential, so the swarm only ever
|
||||
sees the hive collector's client: `sender` names the hive collector that
|
||||
forwarded an agent's data, never the agent.
|
||||
|
||||
If you need per-agent numbers you can act on, take them from the agent's own
|
||||
harness metrics rather than from a metric label.
|
||||
|
||||
### Authenticated ingest
|
||||
|
||||
The swarm tier gives **each hive its own receiver**, and stamps the `hive` label
|
||||
from whichever receiver accepted a sample. A hive therefore can't report
|
||||
metrics as another hive, and can't relabel its own by editing what it sends —
|
||||
the label isn't taken from the payload at all.
|
||||
The swarm tier checks a token at **one receiver per audience**, because an OIDC
|
||||
authenticator accepts exactly one. Every receiver feeds the same pipelines, and
|
||||
the first processor in them deletes any `sender` the payload carried, then sets
|
||||
`sender` from the token's `client_id` claim. The collector stamps no `hive`. A hive
|
||||
collector therefore can't report metrics as another sender, and can't relabel
|
||||
its own by editing what it sends — the label isn't taken from the payload at
|
||||
all. A token without the claim leaves the record with no `sender`, never one the
|
||||
sender chose.
|
||||
|
||||
**Nothing to set where the hive holds its store identity.** The hive's collector
|
||||
reads its secret from the swarm's secret store under the hive's own leaf
|
||||
|
|
@ -232,9 +236,9 @@ automatically:
|
|||
| `agent` | agent logical name (for example `iris`) |
|
||||
| `swarm` | swarm display name (`services.hyperhive.swarm.name`, if set) |
|
||||
|
||||
The swarm's collector adds `hive`, the name of the hive whose receiver accepted
|
||||
the push (see [Authenticated ingest](#authenticated-ingest)). The container
|
||||
doesn't set it.
|
||||
The swarm's collector adds `sender`, the client id the push authenticated as
|
||||
(see [Authenticated ingest](#authenticated-ingest)). The container doesn't set
|
||||
it.
|
||||
|
||||
Append additional labels for one hive via `extraResourceAttributes` (see
|
||||
option reference above). Agents get them at container start, so a change
|
||||
|
|
@ -362,8 +366,8 @@ filters those series out and the host dashboard's top-10 panels group by
|
|||
The `hyperhive.`-prefixed metrics have no semconv equivalent (memory
|
||||
limit + peak, on-disk footprint, and an instantaneous cpu percent kept
|
||||
alongside the spec `container.cpu.time` counter for convenience). The `swarm`
|
||||
label rides on the resource, and the swarm collector adds `hive` from the
|
||||
receiver that accepted the sample. Any other label goes in the hive's
|
||||
label rides on the resource, and the swarm collector adds `sender` from the
|
||||
client id the push authenticated as. Any other label goes in the hive's
|
||||
`extraResourceAttributes`.
|
||||
|
||||
<!-- vale write-good.Passive = NO -->
|
||||
|
|
@ -490,7 +494,7 @@ only until then.
|
|||
|
||||
Resource attributes (`service.name`, `agent`, `swarm`) come from the
|
||||
same container-wide `OTEL_RESOURCE_ATTRIBUTES` as everything else in this
|
||||
section, and the swarm's collector adds `hive` — nothing extra to configure.
|
||||
section, and the swarm's collector adds `sender` — nothing extra to configure.
|
||||
The export cadence is a fixed 60s, the same
|
||||
as `hive-c0re`'s container-resource export above. That only controls how often
|
||||
the harness flushes the batched points to the collector, not how often it
|
||||
|
|
@ -526,12 +530,12 @@ whole-swarm spend figure.
|
|||
|
||||
<!-- vale write-good.Passive = NO -->
|
||||
|
||||
hive-c0re measures everything above **per agent**, tagged with the hive it
|
||||
runs in. It measures these six per **hive** instead, and they carry no
|
||||
hive-c0re measures everything above **per agent**. It measures these six per
|
||||
**hive** instead, and they carry no
|
||||
`agent` label — so a hive
|
||||
that hosts no agents still reports, and "this hive is quiet" is
|
||||
distinguishable from "this hive is gone." Select them with
|
||||
`{hive!="",agent=""}`.
|
||||
`{sender!="",agent=""}`.
|
||||
|
||||
<!-- vale write-good.Passive = YES -->
|
||||
|
||||
|
|
@ -705,7 +709,7 @@ data point each, unix seconds:
|
|||
| `bao.client_cert.not_after` | `s` | gauge | `cert` |
|
||||
|
||||
`cert` names the identity (`client`, `controller`, `agent`, `review-classifier`,
|
||||
`ci-metrics`, `builder`); the resource labels (`service.name`, `hive`, `agent`) say who
|
||||
`ci-metrics`, `builder`); the resource labels (`service.name`, `sender`, `agent`) say who
|
||||
holds it. `swarm_secret_client::cert_metrics` (cargo feature `otel`) registers both gauges on the service's
|
||||
existing exporter and reads `BAO_CLIENT_CERT` at every collection, so a
|
||||
renewed leaf shows up on the next export. A file that's missing, or that isn't a
|
||||
|
|
@ -731,9 +735,9 @@ invisible to them.
|
|||
|
||||
The swarm Grafana alerts on the lifetime fraction:
|
||||
|
||||
| Alert | Fires when |
|
||||
| ----------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `hh-bao-client-cert-lifetime` | `(time() - not_before) / (not_after - not_before)` stays above 0.8 for 10 minutes, per `service.name`, `cert`, `hive` and `agent` |
|
||||
| Alert | Fires when |
|
||||
| ----------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `hh-bao-client-cert-lifetime` | `(time() - not_before) / (not_after - not_before)` stays above 0.8 for 10 minutes, per `service.name`, `cert`, `sender` and `agent` |
|
||||
|
||||
The two gauges of a series carry identical labels, so MetricsQL divides them
|
||||
one-to-one without `on()` or `group_left`. The query wraps each in
|
||||
|
|
|
|||
|
|
@ -588,7 +588,7 @@ The same pass checks each of the hive's agents. It reads the agent's record in
|
|||
It checks that a signature by the public key covers the narinfo, in Rust, with
|
||||
no help from the host's nix daemon. It downloads nothing. The result is a log
|
||||
line (at info when it changes) and the gauge
|
||||
`hyperhive.agent.closure_pullable{agent}` (the `hive` label comes from the
|
||||
`hyperhive.agent.closure_pullable{agent}` (the `sender` label comes from the
|
||||
collector, as for every `hyperhive.*` metric): `1` when the hive can pull the
|
||||
latest closure, else `0` with a `reason` label. The first check that fails
|
||||
decides the reason:
|
||||
|
|
|
|||
|
|
@ -58,17 +58,17 @@ Grafana start — see [`credentials.md`](../../2-handbook/swarm/credentials.md).
|
|||
kept.
|
||||
|
||||
- `agents`: per-agent resource usage and Claude Code activity. The **activity** tab ends with a **Busiest agents** table: turns, input, output and cache-read tokens, and cost for each agent in the range, busiest first. The **turns** tab holds what the retired per-agent stats page showed about turns: average turn duration, cache hit rate and tokens per turn, turns per hour by agent and by model, the turn duration over time (median, 95th percentile and mean), and the mix of wake sources and results. It also has the tools called, the commands bash tasks ran, reminders per hour, the first-turn context size and fresh sessions per agent: everything that page showed, except the per-bucket token bars the **cost** tab covers. The duration percentiles are right from the first deploy that includes the histogram bounds in `hive-agent`; before it, they read a flat 10 seconds.
|
||||
- `attic`: the swarm binary cache. Agents whose latest closure this hive can pull, and why not; the builder's pushes and push failures; closures hive-c0re pulled and deploy steps it refused; the cache's size and store-path count. It reads the closure-pullable gauge, the `swarm-builder` and `hive-c0re` logs, and the `hyperhive.attic.cache_bytes` and `hyperhive.attic.cache_nars` gauges, which a timer in the `swarm-attic` container (`swarm-attic-cache-size`) reads from atticd's database every five minutes and pushes through the container's forwarder. atticd itself exports no metrics and its logs don't reach the log store, so the board has no cache request or hit panel. Filter by hive and agent.
|
||||
- `archive`: the restic backups of every agent to the swarm archive. Per agent: time since the last successful backup (red over two hours, twice the default hourly schedule), the last run's result, duration and bytes added, then snapshots, repository size and the last prune and the last check. Failures and recent runs come from the `hive-archive-backup`, `swarm-archive-prune` and `swarm-archive-check` logs. The numbers are the `hyperhive.archive.backup.*` gauges, which each hive's backup unit pushes after every agent, the `hyperhive.archive.prune.*` and `hyperhive.archive.repo.*` gauges, which the prune unit pushes after every repository when its host runs a hive, and the `hyperhive.archive.check.*` gauges from the check unit. A hive that predates them shows no data for its agents; the log panels work regardless. Filter by hive and agent.
|
||||
- `attic`: the swarm binary cache. Agents whose latest closure this hive can pull, and why not; the builder's pushes and push failures; closures hive-c0re pulled and deploy steps it refused; the cache's size and store-path count. It reads the closure-pullable gauge, the `swarm-builder` and `hive-c0re` logs, and the `hyperhive.attic.cache_bytes` and `hyperhive.attic.cache_nars` gauges, which a timer in the `swarm-attic` container (`swarm-attic-cache-size`) reads from atticd's database every five minutes and pushes through the container's forwarder. atticd itself exports no metrics and its logs don't reach the log store, so the board has no cache request or hit panel. Filter by agent.
|
||||
- `archive`: the restic backups of every agent to the swarm archive. Per agent: time since the last successful backup (red over two hours, twice the default hourly schedule), the last run's result, duration and bytes added, then snapshots, repository size and the last prune and the last check. Failures and recent runs come from the `hive-archive-backup`, `swarm-archive-prune` and `swarm-archive-check` logs. The numbers are the `hyperhive.archive.backup.*` gauges, which each hive's backup unit pushes after every agent, the `hyperhive.archive.prune.*` and `hyperhive.archive.repo.*` gauges, which the prune unit pushes after every repository when its host runs a hive, and the `hyperhive.archive.check.*` gauges from the check unit. A hive that predates them shows no data for its agents; the log panels work regardless. Filter by agent.
|
||||
- `authelia`, `bao`, `queue`: the identity provider, the secret store and the NATS queue.
|
||||
- `claude-usage`: Claude use by model, effort, token type and source. Filter by hive, service (agents or the review classifier) and agent. The service filter separates the classifier's API-key spend from the agents.
|
||||
- `claude-usage`: Claude use by model, effort, token type and source. Filter by service (agents or the review classifier) and agent. The service filter separates the classifier's API-key spend from the agents.
|
||||
- `egress`: what agents send through the egress proxy, in three tabs. **overview** has the totals (requests, agents active, refused, credential challenges, data transferred), requests over time by status, the busiest agents and destinations, and data transferred by domain over time (the top 10 domains plus an other line, summed from the proxy's access log in VictoriaLogs; the proxy logs a CONNECT tunnel when it closes, so a long-lived connection shows as one spike at close). **refused** lists the hosts the proxy refused for each agent. **would-deny** lists what agents in `log` mode reached that restricted mode would refuse. The host lists are tables, one row per host (and agent), with a count column you can sort. Filter by agent and by domain, to see which agents queried a domain and when.
|
||||
- `builds`: the container builds hive-c0re ran on every hive, in two tabs. **builds** has the count, the failures and the longest, builds over time by outcome, and a table of each build with its id, agent, kind, outcome and runtime. **output** shows every line of the build picked in the **Build** filter, with its start and finish lines. It reads the lines hive-c0re logs for each build, so a hive-c0re that doesn't log them leaves it empty. Filter by agent.
|
||||
- `controller`: the swarm controller's job graph by state, and the push and commit rates it sees on the forge.
|
||||
- `review-classifier`: review requests by outcome, the verdict mix, results per check, retried asks, and run duration p50 and p95.
|
||||
- `forge`: the forge, in three tabs. **content** has what the forge holds (repositories, users, issues, releases, discussion volume and the issues by label). **runtime** has the forge process's CPU, memory, goroutines and descriptors. **CI runs** has Actions run time and queue wait per repo and workflow, with a per-PR table; the Repo and Workflow filters apply to that tab.
|
||||
- `gateway`: the gateway nginx on each hive's host: requests per second, connections by state, and accepted against handled connections.
|
||||
- `host`: the machine under each hive, from the collector's host metrics: CPU by state, load, memory, swap and paging, disk and network throughput, filesystem usage, the Nix store's share and the busiest agent containers. Filter by hive and host.
|
||||
- `gateway`: the gateway nginx on each hive's host: requests per second, connections by state, and accepted against handled connections. Filter by host.
|
||||
- `host`: the machine under each hive, from the collector's host metrics: CPU by state, load, memory, swap and paging, disk and network throughput, filesystem usage, the Nix store's share and the busiest agent containers. Filter by host.
|
||||
- `collector`: what the hive and swarm OTEL collectors accept, refuse, export and queue, with queue depth against capacity.
|
||||
- `logstore`, `metricstore`: health of the log store and the metrics store.
|
||||
- `grafana`: Grafana itself. Dashboards and data sources, alert instances firing, requests by status and their latency, alert rule evaluations and failures, sign-ins, database connections, memory and goroutines.
|
||||
|
|
@ -242,6 +242,20 @@ the collector's 4xx included. A switch leaves a window of about 20 seconds in wh
|
|||
nginx and the container are out of step: the container stops before nginx
|
||||
restarts and starts about 18 seconds after it. Senders retry through that window.
|
||||
|
||||
**What the collector stamps.** Every authenticated receiver feeds one metrics
|
||||
pipeline and one logs pipeline. Their first processor, `resource/sender`,
|
||||
deletes any `sender` and `hive` attribute the payload carried, then sets
|
||||
`sender` from the token's `client_id` claim and `swarm` to the swarm's display
|
||||
name. `sender` is therefore the client that authenticated: `hive-<name>` for a
|
||||
hive's collector, the service's own client for a service forwarder. A token
|
||||
without the claim leaves the record with no `sender`. The collector stamps no
|
||||
`hive` label. A hive is a place an agent runs: dashboards and alerts select an
|
||||
agent by `agent` and a machine by `host.name`, and the alert `no log records
|
||||
from <hive>` selects on `sender`. Records that nothing authenticated (the
|
||||
host's journal, the collector's own journal and the Prometheus scrapes) carry
|
||||
`swarm` and no `sender`. A `batch` processor must never run before
|
||||
`resource/sender`, because a batch drops the authentication context.
|
||||
|
||||
The collector fetches authelia's discovery document through the gateway when
|
||||
it starts and exits if that fails. systemd restarts it with no start limit and a
|
||||
delay that grows from 2 to 60 seconds, so it comes back by itself once the
|
||||
|
|
@ -252,7 +266,7 @@ opentelemetry-collector` shows why the collector didn't start. A collector that
|
|||
keeps retrying never reaches `failed`, so `systemctl --failed` doesn't list it.
|
||||
The signals are `swarm-otel-sockets` failing and the Grafana alert
|
||||
`no log records from <hive>`, which fires after about 15 minutes without a log
|
||||
record from a hive.
|
||||
record stamped with that hive's `sender`.
|
||||
|
||||
Every hive's own collector reaches this one by its gateway name,
|
||||
`swarm.otel.domain` (default `otel.<swarm domain>`) — the same
|
||||
|
|
@ -277,7 +291,7 @@ authelia, cache, forge and homeserver have a forwarder client of their own
|
|||
(`swarm.<service>.otel.clientId`). Their records carry `service.name` (`bao`,
|
||||
`nats`, `builder`, `claude-login`, `notify-router`, `review-classifier`, `ci-runner`,
|
||||
`grafana`, `victorialogs`, `victoriametrics`, `authelia`, `attic`, `forgejo`,
|
||||
`tuwunel`) and no `hive` label. The forwarder of all but the store's is
|
||||
`tuwunel`) and the `sender` of its own client id. The forwarder of all but the store's is
|
||||
`nix/container-modules/swarm-journal-forwarder.nix`.
|
||||
|
||||
**The homeserver's metrics.** tuwunel 1.9.4 exports no metrics of its own, so
|
||||
|
|
@ -302,7 +316,7 @@ stand in for them, and neither adds a service:
|
|||
The swarm collector's own container, `swarm-otel`, has no forwarder: its
|
||||
collector reads the container's journal itself (receiver `journald/self`) and
|
||||
exports it to the log store like the host's journal, stamped `service.name`
|
||||
`swarm-otel` and with no `hive` label. Unlike the host's journal, it goes to the
|
||||
`swarm-otel` and with no `sender`, since nothing authenticated it. Unlike the host's journal, it goes to the
|
||||
log store only, never the upstream: the collector writes an upstream export failure to this
|
||||
journal, and shipping it upstream would fail again. A `filter` processor also
|
||||
drops the collector's own failure lines that name the store exporter
|
||||
|
|
|
|||
Loading…
Reference in a new issue