severity_number_to_level

Function severity_number_to_level 

Source
pub fn severity_number_to_level(sev: i32) -> i32
Expand description

Maps OTel severity_number (1–24) to micromegas Level (1–6).

Per the plan:

  • TRACE 1–4 → 6
  • DEBUG 5–8 → 5
  • INFO 9–12 → 4
  • WARN 13–16 → 3
  • ERROR 17–20 → 2
  • FATAL 21–24 → 1

severity_number = 0 (UNSPECIFIED) → 4 (Info), so the default WHERE level <= 4 filter keeps them visible — the SDK didn’t tell us they were low-priority, so we don’t bury them. Out-of-range (negative or > 24) → 4 (Info) as well; promoting an unknown severity to Fatal would silently pollute alerting when a buggy SDK is off-by-one on the FATAL range.