k8s: pod logs and metrics reach the hive collector
This commit is contained in:
parent
65a167d46c
commit
dbcc47573e
1 changed files with 447 additions and 51 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue