Watch
0
0
Fork
You've already forked hyperhive
0

swarm-otel: the upstream export is a swarm-otel deploy option

The external export is a setting of the swarm collector, so it moves to
services.hyperhive.deploy.swarm-otel.upstream. Renamed:
- otel.endpoint -> upstream.endpoint
- otel.protocol -> upstream.protocol
- otel.headersCredential -> upstream.headersCredential
- otel.collector.upstreamHeaderName -> upstream.headerName
The unreleased otel.upstreamSignals is declared as upstream.signals.

Hosts keep working through the rename warnings. Eval test covers the old
paths reaching the new options. Docs and stale comments point at the
new paths.
This commit is contained in:
atlas 2026-10-21 10:25:26 +02:00
commit 41a7974b9e
7 changed files with 206 additions and 144 deletions

View file

@ -41,14 +41,28 @@ let
deploy.victorialogs.enable = false;
# An upstream makes `logExporterNames` longer than the store alone, which
# is what the self-journal case below needs to tell the two apart.
otel.endpoint = "https://upstream.example/otel";
otel.upstreamSignals = upstreamSignals;
deploy.swarm-otel.upstream.endpoint = "https://upstream.example/otel";
deploy.swarm-otel.upstream.signals = upstreamSignals;
};
otelNoStores = mkOtelNoStores [
"metrics"
"logs"
];
# A host config still on the `otel.*` upstream paths, every shipped one.
otelOldUpstreamPaths = hive {
deploy.swarm-otel.enable = true;
deploy.authelia.enable = true;
deploy.bao.clientCertFile = "/etc/pki/bao-client.pem";
deploy.bao.clientKeyFile = "/etc/pki/bao-client-key.pem";
deploy.bao.otelOidcClientCertFile = "/etc/pki/bao-otel-oidc.pem";
deploy.bao.otelOidcClientKeyFile = "/etc/pki/bao-otel-oidc-key.pem";
otel.endpoint = "https://old.example/otel";
otel.protocol = "http/json";
otel.headersCredential = "/run/secrets/old-otel-headers";
otel.collector.upstreamHeaderName = "X-Old-Token";
};
# The same collector with the upstream limited to one signal, and with none.
otelUpstreamMetricsOnly = mkOtelNoStores [ "metrics" ];
otelUpstreamNone = mkOtelNoStores [ ];
@ -356,10 +370,33 @@ let
&& !(lib.any (n: builtins.elem "otlphttp" ps.${n}.exporters) (names "logs/"))
&& lib.all (n: builtins.elem "otlphttp/victorialogs" ps.${n}.exporters) (names "logs/");
}
{
# The control is `otelNoStores`: it sets the new paths and warns about
# none of the old ones, so the warnings below come from the renames.
name = "the old otel.* upstream paths set deploy.swarm-otel.upstream and warn";
ok =
let
u = otelOldUpstreamPaths.services.hyperhive.deploy.swarm-otel.upstream;
warnsAbout = m: path: lib.any (lib.hasInfix "services.hyperhive.${path}") m.warnings;
in
u.endpoint == "https://old.example/otel"
&& u.protocol == "http/json"
&& u.headersCredential == "/run/secrets/old-otel-headers"
&& u.headerName == "X-Old-Token"
&& warnsAbout otelOldUpstreamPaths "otel.endpoint"
&& warnsAbout otelOldUpstreamPaths "otel.protocol"
&& warnsAbout otelOldUpstreamPaths "otel.headersCredential"
&& warnsAbout otelOldUpstreamPaths "otel.collector.upstreamHeaderName"
&& !(warnsAbout otelNoStores "otel.endpoint")
&&
otelNoStores.services.hyperhive.deploy.swarm-otel.upstream.endpoint
== "https://upstream.example/otel"
&& (otelSettings otelOldUpstreamPaths).exporters ? otlphttp;
}
{
# The collector rejects an exporter no pipeline uses, so with nothing
# going upstream the exporter must not be defined.
name = "an empty upstreamSignals defines no upstream exporter and keeps the stores";
name = "an empty upstream.signals defines no upstream exporter and keeps the stores";
ok =
let
s = otelSettings otelUpstreamNone;