diff --git a/kiwi_simple_metrics/metrics.py b/kiwi_simple_metrics/metrics.py index 9a78e96..85e3432 100644 --- a/kiwi_simple_metrics/metrics.py +++ b/kiwi_simple_metrics/metrics.py @@ -64,7 +64,18 @@ def disk_metric() -> Report | None: value=percent, ) for path, percent in data] - return Report( - ", ".join(report.result for report in reports), - failed=any(report.failed for report in reports), + report_inner = ", ".join( + report.result + for report in reports[:SETTINGS.disk.count] + ) + + return Report( + SETTINGS.disk.report_outer.format( + name="DISK FREE", + inner=report_inner, + ), + failed=any( + report.failed + for report in reports + ), ) diff --git a/kiwi_simple_metrics/settings.py b/kiwi_simple_metrics/settings.py index 260679c..8852d95 100644 --- a/kiwi_simple_metrics/settings.py +++ b/kiwi_simple_metrics/settings.py @@ -19,9 +19,15 @@ class MetricSettings(BaseModel): class DiskMS(MetricSettings): + # outer format string for reporting + report_outer: str = "{name}: [{inner}]" + # paths to check for disk space paths: list[DirectoryPath] = Field(default_factory=list) + # include only `count` many of the paths with the least free space + count: int = 1 + class Settings(BaseSettings): model_config = SettingsConfigDict(