kiwi-simple-metrics/kiwi_simple_metrics/settings/__init__.py

41 lines
934 B
Python
Raw Permalink Normal View History

2023-09-01 00:26:29 +00:00
from pydantic_settings import BaseSettings, SettingsConfigDict
from . import metric, misc
from .metric import MetricSettings
class Settings(BaseSettings):
model_config = SettingsConfigDict(
2023-09-02 15:26:33 +00:00
env_prefix="METRICS__",
2023-09-01 00:26:29 +00:00
env_nested_delimiter="__",
)
# time between gathering reports
interval: float = 600
# reporting to stdout
log: misc.LogSettings = misc.LogSettings()
# separates metrics and values in reports
separator: str = ", "
2023-09-02 02:38:12 +00:00
# maximum threads for concurrent metric execution
threads: int | None = None
2023-09-01 00:26:29 +00:00
# metrics settings
cpu: metric.CpuMS = metric.CpuMS()
memory: metric.MemoryMS = metric.MemoryMS()
disk: metric.DiskMS = metric.DiskMS()
external: metric.ExternalMS = metric.ExternalMS()
2023-09-01 00:26:29 +00:00
# pinging webhooks
webhook: misc.WebhookSettings = misc.WebhookSettings()
SETTINGS = Settings()
__all__ = [
"MetricSettings",
"SETTINGS",
]