mirror of
https://github.com/yavook/kiwi-simple-metrics.git
synced 2024-11-21 23:32:59 +00:00
Merge branch 'develop' into release/0.1.0
This commit is contained in:
commit
e4296327b0
3 changed files with 9 additions and 5 deletions
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
|
@ -12,7 +12,7 @@
|
||||||
"env": {
|
"env": {
|
||||||
"METRIC__INTERVAL": "5",
|
"METRIC__INTERVAL": "5",
|
||||||
"METRIC__LOG__ENABLED": "True",
|
"METRIC__LOG__ENABLED": "True",
|
||||||
"METRIC__DISK__PATHS": "[\"/var\", \"/\", \"/dev\"]",
|
"METRIC__EXTERNAL__ENABLED": "True",
|
||||||
"METRIC__EXTERNAL__EXECUTABLES": "[\"${workspaceFolder}/example/dummy-metric\"]",
|
"METRIC__EXTERNAL__EXECUTABLES": "[\"${workspaceFolder}/example/dummy-metric\"]",
|
||||||
},
|
},
|
||||||
"justMyCode": true
|
"justMyCode": true
|
||||||
|
|
|
@ -102,6 +102,9 @@ class Report:
|
||||||
|
|
||||||
reports = [data.report for data in get_data()]
|
reports = [data.report for data in get_data()]
|
||||||
|
|
||||||
|
if not reports:
|
||||||
|
return None
|
||||||
|
|
||||||
return cls(
|
return cls(
|
||||||
result=settings.report_outer.format(
|
result=settings.report_outer.format(
|
||||||
name=settings.name,
|
name=settings.name,
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import math
|
import math
|
||||||
from typing import Any, Literal
|
from typing import Any, Literal
|
||||||
|
|
||||||
from pydantic import (BaseModel, DirectoryPath, Field, FieldValidationInfo,
|
from pydantic import (BaseModel, DirectoryPath, FieldValidationInfo, FilePath,
|
||||||
FilePath, field_validator)
|
field_validator)
|
||||||
|
|
||||||
|
|
||||||
class MetricSettings(BaseModel):
|
class MetricSettings(BaseModel):
|
||||||
|
@ -81,15 +81,16 @@ class DiskMS(MetricSettings):
|
||||||
count: int | None = 1
|
count: int | None = 1
|
||||||
|
|
||||||
# paths to check for disk space
|
# paths to check for disk space
|
||||||
paths: list[DirectoryPath] = Field(default_factory=list)
|
paths: list[DirectoryPath] = [DirectoryPath("/")]
|
||||||
|
|
||||||
|
|
||||||
class ExternalMS(MetricSettings):
|
class ExternalMS(MetricSettings):
|
||||||
name: str = "External Metric"
|
name: str = "External Metric"
|
||||||
|
enabled: bool = False
|
||||||
threshold: float = 0
|
threshold: float = 0
|
||||||
|
|
||||||
# path to executable files
|
# path to executable files
|
||||||
executables: list[FilePath] = Field(default_factory=list)
|
executables: list[FilePath] = []
|
||||||
|
|
||||||
# wait at most this many seconds for each executable
|
# wait at most this many seconds for each executable
|
||||||
timeout: int = 60
|
timeout: int = 60
|
||||||
|
|
Loading…
Reference in a new issue