diff --git a/.vscode/launch.json b/.vscode/launch.json index 5872269..f702240 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -10,7 +10,7 @@ "request": "launch", "module": "kiwi_simple_metrics.main", "env": { - "METRIC_DISK__PATHS": "[\"/var\", \"/\", \"/dev\"]", + "METRIC__DISK__PATHS": "[\"/var\", \"/\", \"/dev\"]", }, "justMyCode": true } diff --git a/kiwi_simple_metrics/metrics/_report.py b/kiwi_simple_metrics/metrics/_report.py index 3ccb57b..c609f1b 100644 --- a/kiwi_simple_metrics/metrics/_report.py +++ b/kiwi_simple_metrics/metrics/_report.py @@ -1,7 +1,7 @@ from dataclasses import dataclass from typing import Any, Callable, Iterator, Self -from ..settings import MetricSettings +from ..settings import SETTINGS, MetricSettings @dataclass(slots=True, kw_only=True) @@ -43,7 +43,7 @@ class Report: ] return cls( - result=", ".join( + result=SETTINGS.separator.join( report.result for report in reports ), @@ -70,7 +70,7 @@ class Report: return cls( result=settings.report_outer.format( name=settings.name, - inner=", ".join( + inner=SETTINGS.separator.join( report.result for report in reports[:settings.count] ), diff --git a/kiwi_simple_metrics/settings.py b/kiwi_simple_metrics/settings.py index 96d8fc2..3d2bf11 100644 --- a/kiwi_simple_metrics/settings.py +++ b/kiwi_simple_metrics/settings.py @@ -84,10 +84,14 @@ class DiskMS(MetricSettings): class Settings(BaseSettings): model_config = SettingsConfigDict( - env_prefix="METRIC_", + env_prefix="METRIC__", env_nested_delimiter="__", ) + # separates metrics and values in reports + separator: str = ", " + + # metrics settings cpu: CpuMS = CpuMS() memory: MemoryMS = MemoryMS() disk: DiskMS = DiskMS()