every hive runs its otel collector, and agents export to it by default
This commit is contained in:
parent
839efd1642
commit
13daf4c7dc
28 changed files with 245 additions and 303 deletions
|
|
@ -47,7 +47,11 @@ let
|
|||
otel.metricIntervalMs = 10000;
|
||||
};
|
||||
|
||||
agentNoOtel = shared.agentBare;
|
||||
# Sets nothing: what an agent gets on a hive, whose meta flake renders no
|
||||
# otel line.
|
||||
agentDefault = shared.agentBare;
|
||||
|
||||
agentNoOtel = agent { otel.enable = false; };
|
||||
|
||||
agentSettings = machine: machine.services.opentelemetry-collector.settings;
|
||||
cases = [
|
||||
|
|
@ -100,11 +104,30 @@ let
|
|||
&& p.exporters != [ ]
|
||||
&& lib.all (e: (s.exporters ? ${e}) && s.exporters.${e}.endpoint == agentBridge) p.exporters;
|
||||
}
|
||||
{
|
||||
# 🎯 What the meta flake no longer says: an agent that sets nothing
|
||||
# exports, to a name rather than an address. The name carries no swarm
|
||||
# domain and no hive, so the same build is correct on every hive; the
|
||||
# resolver of the hive it runs on answers it. `agentNoOtel` above is the
|
||||
# control that these lookups find nothing where the switch is off.
|
||||
name = "an agent with no otel config exports to the fixed hive-collector name by default";
|
||||
ok =
|
||||
let
|
||||
endpoint = "http://hive-collector.hive:4318";
|
||||
env = agentDefault.systemd.globalEnvironment;
|
||||
s = agentSettings agentDefault;
|
||||
in
|
||||
agentDefault.services.hyperhive.agent.otel.enable
|
||||
&& env.OTEL_EXPORTER_OTLP_ENDPOINT == endpoint
|
||||
&& agentDefault.environment.variables.OTEL_EXPORTER_OTLP_ENDPOINT == endpoint
|
||||
&& lib.all (e: s.exporters.${e}.endpoint == endpoint) s.service.pipelines.logs.exporters
|
||||
&& !(agentNoOtel.systemd.globalEnvironment ? OTEL_EXPORTER_OTLP_ENDPOINT);
|
||||
}
|
||||
{
|
||||
# Presence control for the two cases above: with the switch off there
|
||||
# is no collector in the container at all, so their passing is about
|
||||
# the wiring rather than about a unit that renders regardless.
|
||||
name = "an agent that has not opted into telemetry runs no collector";
|
||||
name = "an agent that switched telemetry off runs no collector";
|
||||
ok = !agentNoOtel.services.opentelemetry-collector.enable;
|
||||
}
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue