pub struct Filter { /* private fields */ }Expand description
Filter holds two directive sets: the immutable startup directives (the
node config’s with the METRICS_FILTER env var’s merged over them) and
the directives currently in effect — the startup directives, with the
runtime override merged over them while one is set.
Implementations§
Source§impl Filter
impl Filter
pub fn parse(s: &str) -> Self
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Builds a filter with an empty config source and the
METRICS_FILTER_ENV variable’s directives (permissive when unset).
Sourcepub fn from_sources(
config: FilterSource<'_>,
env: Option<FilterSource<'_>>,
) -> Self
pub fn from_sources( config: FilterSource<'_>, env: Option<FilterSource<'_>>, ) -> Self
Builds a filter whose startup directives are the env source merged over the config source: env directives win on conflict.
Sourcepub fn is_exposed(&self, name: &str, module: &str, level: MetricLevel) -> bool
pub fn is_exposed(&self, name: &str, module: &str, level: MetricLevel) -> bool
Returns true if a registered metric named name in module at
verbosity level should be exposed when gathering, per the directives
currently in effect.
Sourcepub fn filter_string(&self) -> String
pub fn filter_string(&self) -> String
Returns the display string of the directives currently in effect.
Sourcepub fn startup_filter_string(&self) -> String
pub fn startup_filter_string(&self) -> String
Returns the startup directives’ display string.
Sourcepub fn set_runtime_filter(
&self,
source: FilterSource<'_>,
) -> StdResult<(), String>
pub fn set_runtime_filter( &self, source: FilterSource<'_>, ) -> StdResult<(), String>
Replaces the directives in effect with the runtime override merged over the startup directives (the override wins on conflict) — each call starts from the startup directives again rather than stacking on the previous override; an override with a bare level replaces the startup directives entirely. Rejects the whole update if any directive is invalid.
Sourcepub fn reset_runtime_filter(&self)
pub fn reset_runtime_filter(&self)
Drops the runtime override, restoring the startup directives.