praval.observability.config

Compatibility imports for the typed Praval configuration system.

Functions

get_config()

Return the v0.8.2-compatible cached observability configuration.

reset_config()

Reset legacy configuration state for test isolation.

class praval.observability.config.ObservabilityConfig(**data)[source]

Bases: _ConfigModel

Observability signal and privacy configuration.

The deprecated sample_rate, otlp_endpoint, and storage_path inputs remain accepted for the v0.8.2 migration window.

Parameters:
  • enabled (bool)

  • capture_content (bool)

  • content_allowlist (tuple[str, ...])

  • sampling (Literal['always_on', 'always_off', 'parentbased_traceidratio'])

  • sample_ratio (float)

  • flush_timeout_millis (int)

  • otlp (OTLPConfig)

  • local (LocalObservabilityConfig)

enabled: bool
capture_content: bool
content_allowlist: tuple[str, ...]
sampling: Literal['always_on', 'always_off', 'parentbased_traceidratio']
sample_ratio: float
flush_timeout_millis: int
otlp: OTLPConfig
local: LocalObservabilityConfig
classmethod map_legacy_fields(value)[source]

Map supported v0.8.2 field names to the typed nested schema.

Return type:

Any

Parameters:

value (Any)

property sample_rate: float

Return the deprecated sampling field.

property otlp_endpoint: str | None

Return the deprecated flat OTLP endpoint.

property storage_path: str

Return the deprecated expanded local path.

is_enabled()[source]

Return whether observability is enabled.

Return type:

bool

should_sample()[source]

Provide the v0.8.2 probabilistic sampling helper.

Return type:

bool

classmethod from_env()[source]

Load supported legacy observability environment variables.

Return type:

ObservabilityConfig

model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'frozen': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

praval.observability.config.get_config()[source]

Return the v0.8.2-compatible cached observability configuration.

Return type:

ObservabilityConfig

praval.observability.config.reset_config()[source]

Reset legacy configuration state for test isolation.

Return type:

None