pub struct Filter { /* private fields */ }Expand description
Parsed obs::Filter. Statics are checked first against the
callsite; dynamics are bucketed by full_name and consulted at
emit time against env.labels.
Implementations§
Source§impl Filter
impl Filter
Sourcepub fn parse(s: &str) -> Result<Filter, FilterParseError>
pub fn parse(s: &str) -> Result<Filter, FilterParseError>
Parse a filter spec string (OBS_FILTER / obs.yaml’s filter).
§Errors
Returns FilterParseError::Malformed when a directive is
syntactically invalid, e.g. =info (missing target/level).
Sourcepub fn add_directive(&mut self, raw: &str) -> Result<(), FilterParseError>
pub fn add_directive(&mut self, raw: &str) -> Result<(), FilterParseError>
Add one directive. Public for programmatic construction.
§Errors
Returns FilterParseError::Malformed when the directive is
syntactically invalid.
Sourcepub fn callsite_interest(&self, callsite: &ObsCallsite) -> Interest
pub fn callsite_interest(&self, callsite: &ObsCallsite) -> Interest
Decide Interest for a static callsite (no envelope visible
yet). Used at first-sight by the runtime to populate the
callsite cache.
Sometimes is returned whenever a dynamic directive references
the callsite — the per-emit event_allowed is then consulted
once the envelope is available.
Spec 94 § 2.2: a static directive that matches the callsite
vetoes inclusion regardless of the global default floor — i.e.
info,my_module=off rejects every my_module::* callsite even
when its default severity is at or above info.
Sourcepub fn event_allowed(&self, env: &ObsEnvelope, callsite_sev: Severity) -> bool
pub fn event_allowed(&self, env: &ObsEnvelope, callsite_sev: Severity) -> bool
Per-emit decision once the envelope is built. Honours dynamic
directives ([field=value]) by reading env.labels.
Sourcepub fn default_level(&self) -> Severity
pub fn default_level(&self) -> Severity
Default severity floor.