feat(#3125): reshape the hive-to-swarm OTEL hop by domain
Drops swarm.otel.url (a loopback default an operator had to override on a split host) in favor of swarm.otel.domain -- the same gateway.localNames + nginx-vhost-through-the-gateway shape every other swarm service (authelia, grafana, victoriametrics, ui) already uses. The hive tier's exporter now reaches it as https://<domain> unconditionally, resolved locally by dnsmasq on a co-located host and over the real network otherwise, instead of a config knob nobody sets until they hit the silent drop. Costs CA trust on the hive tier: otel.nix wires lib/hive-ca-trust.nix's trustBundle with hostUnit = true on the opentelemetry-collector host unit, the same flag #3441/#3442 added for swarm-controller and hive-c0re. mara, #3125 comment 58363: "go c".
This commit is contained in:
parent
28623e5eff
commit
d2fb4bff79
5 changed files with 96 additions and 37 deletions
|
|
@ -14,11 +14,41 @@
|
|||
# upstream options declared below describe that far end and are read one
|
||||
# tier up — they stay here because they mean what they have always meant.
|
||||
{
|
||||
pkgs,
|
||||
lib,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
# This tier now reaches the swarm's collector by name through the
|
||||
# gateway (`swarm-otel.nix`'s `domain`) instead of a loopback URL, so it
|
||||
# needs the same hive-CA trust every other host consumer of an `https://`
|
||||
# swarm-service name needs — see `swarm-controller.nix` for the sibling
|
||||
# wiring this copies.
|
||||
#
|
||||
# `hostUnit`: `opentelemetry-collector` is a host systemd service, not a
|
||||
# container, so it reads the CA from the host path and the bundle oneshot
|
||||
# waits on `hive-tls-ca.service` itself. `enable`: `imports` is
|
||||
# unconditional at the host's top level, so without it a hive with this
|
||||
# tier off would still get a bundle oneshot and a phantom
|
||||
# `opentelemetry-collector` service holding an `SSL_CERT_FILE`.
|
||||
caTrust = import ./lib/hive-ca-trust.nix {
|
||||
inherit lib;
|
||||
tlsCfg = config.services.hyperhive.tls;
|
||||
gatewayCfg = config.services.hyperhive.gateway;
|
||||
};
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
(caTrust.trustBundle {
|
||||
inherit pkgs;
|
||||
name = "hive-otel";
|
||||
consumers = [ "opentelemetry-collector" ];
|
||||
hostUnit = true;
|
||||
enable = config.services.hyperhive.otel.enable;
|
||||
})
|
||||
];
|
||||
|
||||
options.services.hyperhive.otel = {
|
||||
enable = lib.mkEnableOption ''
|
||||
hive-wide export of every agent's Claude Code stats (token usage,
|
||||
|
|
@ -225,14 +255,15 @@
|
|||
# store exporter needs `metrics_endpoint` while this one must
|
||||
# not have it.
|
||||
#
|
||||
# Addressed by the option rather than by a loopback literal:
|
||||
# the default already points at the co-located tier, and a
|
||||
# hive whose swarm collector lives elsewhere then names it in
|
||||
# config instead of needing this file changed. A loopback
|
||||
# literal is correct only while listener and caller share a
|
||||
# netns, an assumption that has cost this project two
|
||||
# outages.
|
||||
endpoint = config.services.hyperhive.swarm.otel.url;
|
||||
# By name through the gateway, not a loopback literal: a
|
||||
# loopback literal is correct only while listener and caller
|
||||
# share a netns, an assumption that has cost this project two
|
||||
# outages, and it is exactly the split-host case a swarm
|
||||
# service name exists to make a config fact rather than a code
|
||||
# change. `https://` because that name resolves through the
|
||||
# gateway even on a co-located host — see `caTrust` above for
|
||||
# the trust half that makes this verify.
|
||||
endpoint = "https://${config.services.hyperhive.swarm.otel.domain}";
|
||||
};
|
||||
|
||||
service.pipelines.metrics = {
|
||||
|
|
|
|||
Loading…
Reference in a new issue