BaseMetricsConfiguration#
- pydantic model safir.metrics.BaseMetricsConfiguration#
Metrics configuration, including the required Kafka configuration.
Currently, this only configures events, but if additional types of metrics are added in the future, that configuration will be added here.
This is the recommended configuration approach if you don’t need to use Kafka, the schema manager, or the schema registry in any other parts of your application. Applications that also use Kafka directly should instead create a
EventManagerwith externally-managed Kafka clients.- Parameters:
_nested_model_default_partial_update (
bool|None, default:None)_env_prefix_target (
Literal['variable','alias','all'] |None, default:None)_env_file (
Path|str|Sequence[Path|str] |None, default:PosixPath('.'))_cli_parse_args (
bool|list[str] |tuple[str,...] |None, default:None)_cli_settings_source (
CliSettingsSource[Any] |None, default:None)_cli_implicit_flags (
bool|Literal['dual','toggle'] |None, default:None)_cli_kebab_case (
bool|Literal['all','no_enums'] |None, default:None)_cli_shortcuts (
Mapping[str,str|list[str]] |None, default:None)_secrets_dir (
Path|str|Sequence[Path|str] |None, default:None)_build_sources (
tuple[tuple[PydanticBaseSettingsSource,...],dict[str,Any]] |None, default:None)values (
Any)
- Config:
populate_by_name: bool = True
validate_by_alias: bool = True
validate_by_name: bool = True
- Fields:
- field events: EventsConfiguration [Optional]#
- classmethod settings_customise_sources(settings_cls, init_settings, env_settings, dotenv_settings, file_secret_settings)#
Define the sources and their order for loading the settings values.
- Args:
settings_cls: The Settings class. init_settings: The
InitSettingsSourceinstance. env_settings: TheEnvSettingsSourceinstance. dotenv_settings: TheDotEnvSettingsSourceinstance. file_secret_settings: TheSecretsSettingsSourceinstance.- Returns:
A tuple containing the sources and their order for loading the settings values.
- abstractmethod make_manager(logger=None, *, kafka_broker=None)#
Construct an
EventManager.- Parameters:
logger (
BoundLogger|None, default:None) – Logger to use for internal logging. If not given, thesafir.metricslogger will be used.kafka_broker (
KafkaBroker|None, default:None) – Kafka broker to use. If not given, a new Kafka broker will be created and automatically closed when the event manager is closed. If a broker is provided, closing the event manager will have no effect on it and the caller is responsible for starting and closing it.
- Returns:
An event manager appropriate to the configuration.
- Return type: