Watch
0
0
Fork
You've already forked hyperhive
0

docs and option text: describe the sender stamp, drop the hive label

This commit is contained in:
atlas 2026-11-22 23:52:52 +01:00 • committed by mara
commit ea84d746dd

View file

@ -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