#[non_exhaustive]pub struct EventsConfig {
pub filter: Option<String>,
pub sampling: SamplingConfig,
pub limits: LimitsConfig,
pub audit: AuditConfig,
pub queues: QueuesConfig,
pub sinks: SinksConfig,
pub service: ServiceConfig,
pub dev_mode: bool,
}Expand description
The complete config tree. Every field is optional so a config file
can be a single line if the user only cares to override filter.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.filter: Option<String>EnvFilter-grammar directives. None ⇒ defer to OBS_FILTER
env var; if both unset, "info" applies.
sampling: SamplingConfigHead/tail sampling tunables.
limits: LimitsConfigPer-event byte caps.
audit: AuditConfigAUDIT-tier delivery policy (Phase 3 task 3.12 implements the
spool; the config struct lives here so user obs.yaml files
already have a stable shape).
queues: QueuesConfigPer-tier mpsc queue capacities (Phase 3 worker pool).
sinks: SinksConfigPer-sink configuration (Phase 3+ implements the sinks; the
config struct lives here so user obs.yaml files already have
a stable shape).
service: ServiceConfigService identity (overrides defaults read from env).
dev_mode: boolDev-mode toggle (OBS_DEV=1 or dev_mode: true). Enables
extra diagnostics intended for local iteration: more verbose
scope-field warnings, source-loc capture, and the
dev_ergonomics test path. Spec 13 § 2.3 / 60 § 7 / spec 94 §
3.10 / P3-A.
Implementations§
Source§impl EventsConfig
impl EventsConfig
Sourcepub fn builder() -> EventsConfigBuilder
pub fn builder() -> EventsConfigBuilder
Builder entry. See spec 15 § 5.1.
Sourcepub fn from_yaml_str(yaml: &str) -> Result<Self, ConfigError>
pub fn from_yaml_str(yaml: &str) -> Result<Self, ConfigError>
Parse YAML bytes into an EventsConfig. Spec 15 § 5.1 / spec
93 P0-9. ${VAR} references in scalar string values are
expanded against the process environment before parsing — set
${VAR:-default} to provide a fallback.
Unknown top-level keys fail parsing (struct is
deny_unknown_fields). The error message is annotated with the
valid root-key set so typos like filtr: surface with an
immediate fix-up hint — boundary-review § 4.1.
§Errors
Returns ConfigError::Yaml when parsing fails (unknown fields,
type mismatch, syntax error). Validation is left to the caller
— call Self::validate after loading.
Sourcepub fn from_yaml_path(path: impl AsRef<Path>) -> Result<Self, ConfigError>
pub fn from_yaml_path(path: impl AsRef<Path>) -> Result<Self, ConfigError>
Read a YAML file from disk.
§Errors
Returns ConfigError::Io when the file cannot be read or
ConfigError::Yaml when parsing fails.
Sourcepub fn merged_with_env(self, prefix: &str) -> Self
pub fn merged_with_env(self, prefix: &str) -> Self
Apply environment-variable overrides under prefix. The
convention is <PREFIX>_<DOTTED_PATH_WITH___INSTEAD_OF_DOTS> —
e.g. OBS_FILTER for filter, OBS_AUDIT__SPOOL_DIR for
audit.spool_dir, OBS_SAMPLING__DEFAULT_RATE for
sampling.default_rate. Values are parsed by re-running
serde_yaml against the resulting flat map. Spec 15 § 5.1 / spec
93 P0-9.
Source§impl EventsConfig
impl EventsConfig
Trait Implementations§
Source§impl Clone for EventsConfig
impl Clone for EventsConfig
Source§fn clone(&self) -> EventsConfig
fn clone(&self) -> EventsConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more