module-eval: pin the severity mapping's direction and the panel
The direction is the part a reviewer cannot check by looking, so it is asserted at both ends of the table and in both tiers' groups: an inverted mapping still maps every value to something, and a case that only asks whether a severity parser exists passes on the exact defect. The reader that turns a rendered operator list back into a PRIORITY -> name function lives in lib.nix, since both tiers need it. The panel is asserted on its query rather than its title, because a panel that keeps the title and loses the expression renders an empty graph that looks exactly like zero prioless lines.
This commit is contained in:
parent
83a604ae23
commit
7fa13b592f
4 changed files with 121 additions and 0 deletions
|
|
@ -18,6 +18,8 @@ let
|
|||
;
|
||||
})
|
||||
hive
|
||||
journaldSeverityOf
|
||||
journaldSeverityOverwritesText
|
||||
runGroup
|
||||
otelSettings
|
||||
;
|
||||
|
|
@ -155,6 +157,34 @@ let
|
|||
in
|
||||
named != [ ] && lib.all (a: builtins.elem a s.service.extensions) named;
|
||||
}
|
||||
{
|
||||
# The host-journal half of the mapping the agent tier's receiver carries
|
||||
# (./agent-otel.nix holds the sibling case and the full reasoning). Both
|
||||
# import one file, so this is what says the swarm collector still does —
|
||||
# the receivers are otherwise unrelated config, and a drifted copy is
|
||||
# silent: every line still arrives, labelled as the wrong thing.
|
||||
#
|
||||
# Asserted at both ends of the table because the direction is inverted
|
||||
# and an inverted copy still maps every value to something.
|
||||
name = "the swarm collector maps the host journal's PRIORITY the right way up";
|
||||
ok =
|
||||
let
|
||||
sev = journaldSeverityOf (otelSettings otelNoStores).receivers.journald;
|
||||
in
|
||||
sev "0" == "fatal"
|
||||
&& sev "3" == "error"
|
||||
&& sev "4" == "warn"
|
||||
&& sev "6" == "info"
|
||||
&& sev "7" == "debug";
|
||||
}
|
||||
{
|
||||
# Same reasoning as the agent tier's copy: without this the parser
|
||||
# populates `severity_text` with the raw digit it matched, which passes
|
||||
# any check asking whether severity is set and is not a level anything
|
||||
# renders.
|
||||
name = "the swarm collector writes a level name, not the raw priority digit";
|
||||
ok = journaldSeverityOverwritesText (otelSettings otelNoStores).receivers.journald;
|
||||
}
|
||||
];
|
||||
in
|
||||
runGroup "swarm-otel-core" cases
|
||||
|
|
|
|||
Loading…
Reference in a new issue