From 835a27e993c569cbd9930f157658d10fd2ae1c78 Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Thu, 24 Oct 2024 16:15:10 -0700 Subject: [PATCH] statsd: don't use datetime in filename (#33868) --- system/statsd.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/system/statsd.py b/system/statsd.py index 5e76b73ae9..b8a7f2c661 100755 --- a/system/statsd.py +++ b/system/statsd.py @@ -2,6 +2,7 @@ import os import zmq import time +import uuid from pathlib import Path from collections import defaultdict from datetime import datetime, UTC @@ -102,6 +103,7 @@ def main() -> NoReturn: sm = SubMaster(['deviceState']) idx = 0 + boot_uid = str(uuid.uuid4())[:8] last_flush_time = time.monotonic() gauges = {} samples: dict[str, list[float]] = defaultdict(list) @@ -164,7 +166,7 @@ def main() -> NoReturn: # check that we aren't filling up the drive if len(os.listdir(STATS_DIR)) < STATS_DIR_FILE_LIMIT: if len(result) > 0: - stats_path = os.path.join(STATS_DIR, f"{current_time.timestamp():.0f}_{idx}") + stats_path = os.path.join(STATS_DIR, f"{boot_uid}_{idx}") with atomic_write_in_dir(stats_path) as f: f.write(result) idx += 1