mirror of
https://github.com/yavook/kiwi-simple-metrics.git
synced 2024-11-24 16:33:01 +00:00
minor last fix-ups
This commit is contained in:
parent
4f67c6158d
commit
4205b04b05
2 changed files with 12 additions and 4 deletions
|
@ -44,15 +44,17 @@ def run_metrics(
|
|||
async def async_main_loop() -> None:
|
||||
loop = asyncio.get_running_loop()
|
||||
|
||||
while True:
|
||||
with concurrent.futures.ThreadPoolExecutor(
|
||||
max_workers=SETTINGS.threads,
|
||||
) as pool:
|
||||
with concurrent.futures.ThreadPoolExecutor(
|
||||
max_workers=SETTINGS.threads,
|
||||
) as pool:
|
||||
while True:
|
||||
# start interval and metrics at the same time
|
||||
await asyncio.gather(
|
||||
asyncio.sleep(SETTINGS.interval),
|
||||
loop.run_in_executor(
|
||||
None, run_metrics,
|
||||
pool,
|
||||
# metrics are reported in this order
|
||||
metrics.cpu,
|
||||
metrics.memory,
|
||||
metrics.disk,
|
||||
|
|
|
@ -93,3 +93,9 @@ class ExternalMS(MetricSettings):
|
|||
|
||||
# wait at most this many seconds for each executable
|
||||
timeout: int = 60
|
||||
|
||||
@field_validator("count", mode="after")
|
||||
@classmethod
|
||||
def force_none(cls, _) -> int | None:
|
||||
"""Don't accept a `count` value for the external metric!"""
|
||||
return None
|
||||
|
|
Loading…
Reference in a new issue