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
|
|||
;
|
||||
})
|
||||
agent
|
||||
journaldSeverityOf
|
||||
journaldSeverityOverwritesText
|
||||
runGroup
|
||||
;
|
||||
|
||||
|
|
@ -56,6 +58,39 @@ let
|
|||
name = "the agent forwarder reads the persistent journal, not the runtime one";
|
||||
ok = ((agentSettings agentOtel).receivers.journald.directory or null) == "/var/log/journal";
|
||||
}
|
||||
{
|
||||
# ⚠️ The direction, and the only part of this mapping a reviewer cannot
|
||||
# check by looking: syslog's PRIORITY counts DOWN in urgency (0 = emerg,
|
||||
# 7 = debug) where the OTEL severity counts UP, so a copy wired across
|
||||
# renders debug as critical while every line still arrives and every
|
||||
# field is populated. Asserted at BOTH ENDS of the table — an inverted
|
||||
# mapping still maps every value to something, so "a severity parser is
|
||||
# configured" passes on the exact defect. The swarm tier's receiver gets
|
||||
# the same case over in ./swarm-otel-core.nix; the two import one file,
|
||||
# and these are what say they still do.
|
||||
name = "the agent forwarder maps PRIORITY to severity the right way up";
|
||||
ok =
|
||||
let
|
||||
sev = journaldSeverityOf (agentSettings agentOtel).receivers.journald;
|
||||
in
|
||||
sev "0" == "fatal"
|
||||
&& sev "3" == "error"
|
||||
&& sev "4" == "warn"
|
||||
&& sev "6" == "info"
|
||||
&& sev "7" == "debug";
|
||||
}
|
||||
{
|
||||
# The other half of the same operator, and the half that looks already
|
||||
# handled. Without `overwrite_text` the parser sets the severity NUMBER
|
||||
# from the mapping and leaves the severity TEXT as the raw value it
|
||||
# matched — so `severity_text` reaches the log store as the literal "6".
|
||||
# That is a populated field which passes any check asking merely whether
|
||||
# severity is set, and which nothing renders as a level. VictoriaLogs has
|
||||
# no ingest parameter naming a level field, so the text is the whole
|
||||
# interface.
|
||||
name = "the agent forwarder writes a level name, not the raw priority digit";
|
||||
ok = journaldSeverityOverwritesText (agentSettings agentOtel).receivers.journald;
|
||||
}
|
||||
{
|
||||
# The hop's two ends: what it reads, and where what it reads goes.
|
||||
# The endpoint is compared against the value the fixture handed the
|
||||
|
|
|
|||
Loading…
Reference in a new issue