Skip to content

Index

provide.foundation.logger.config

Foundation Logger Configuration Module.

Re-exports all configuration classes for convenient importing.

Classes

LoggingConfig

Bases: RuntimeConfig

Configuration specific to logging behavior within Foundation Telemetry.

TelemetryConfig

Bases: RuntimeConfig

Main configuration object for the Foundation Telemetry system.

Functions
from_env classmethod
from_env(
    prefix: str = "",
    delimiter: str = "_",
    case_sensitive: bool = False,
) -> TelemetryConfig

Load configuration from environment variables.

This method explicitly provides the from_env() interface to ensure it's available on TelemetryConfig directly.

If OpenObserve is configured and reachable, OTLP settings are automatically configured if not already set.

Source code in provide/foundation/logger/config/telemetry.py
@classmethod
def from_env(
    cls,
    prefix: str = "",
    delimiter: str = "_",
    case_sensitive: bool = False,
) -> TelemetryConfig:
    """Load configuration from environment variables.

    This method explicitly provides the from_env() interface
    to ensure it's available on TelemetryConfig directly.

    If OpenObserve is configured and reachable, OTLP settings are
    automatically configured if not already set.
    """
    # Load base configuration
    config = super().from_env(prefix=prefix, delimiter=delimiter, case_sensitive=case_sensitive)

    # Auto-configure OTLP if OpenObserve is available and OTLP not already configured
    if not config.otlp_endpoint:
        config = cls._auto_configure_openobserve_otlp(config)

    return config
get_otlp_headers_dict
get_otlp_headers_dict() -> dict[str, str]

Get OTLP headers dictionary.

Returns:

Type Description
dict[str, str]

Dictionary of header key-value pairs

Source code in provide/foundation/logger/config/telemetry.py
def get_otlp_headers_dict(self) -> dict[str, str]:
    """Get OTLP headers dictionary.

    Returns:
        Dictionary of header key-value pairs

    """
    return self.otlp_headers