Watch
0
0
Fork
You've already forked hyperhive
0

k8s: pod logs and metrics reach the hive collector

This commit is contained in:
atlas 2026-11-21 14:01:39 +01:00 • committed by maia
commit 4ec7513b1b

View file

@ -73,6 +73,25 @@ let
};
};
# Where a pod pushes telemetry: the hive collector, by the name the node's
# CoreDNS answers with the bridge address (./host-services.nix). A unit's own
# endpoint is a loopback forwarder or a gateway route that needs a token, and
# a pod has neither. `otlpEndpointVars` are the variables a unit may name its
# endpoint in; the first is the standard one and is always set.
otelCfg = hyperhiveCfg.otel;
collectorEndpoint = "http://${otelCfg.collector.host}:${toString hyperhiveCfg.swarm.hiveOtel.collectorPort}";
otlpEndpointVars = [
"OTEL_EXPORTER_OTLP_ENDPOINT"
"SWARM_CI_METRICS_OTLP_ENDPOINT"
];
podOtlpEnv =
unitEnv:
lib.optionalAttrs otelCfg.collector.enable (
lib.genAttrs (lib.filter (
n: n == "OTEL_EXPORTER_OTLP_ENDPOINT" || unitEnv ? ${n}
) otlpEndpointVars) (_: collectorEndpoint)
);
fail = name: msg: throw "services.hyperhive.k8s: ${name}: ${msg}";
labelsFor = name: {
@ -127,6 +146,7 @@ let
env =
unitEnv
// podOtlpEnv unitEnv
// lib.optionalAttrs (runtimeDir != null) { RUNTIME_DIRECTORY = runtimeDir; }
// lib.optionalAttrs (stateDir != null) { STATE_DIRECTORY = stateDir; }
// lib.optionalAttrs (svc.healthEnv != null) {