From dd55d14bb1a1bc7c7d4fdfbf1b1344562d11f847 Mon Sep 17 00:00:00 2001 From: Willem Melching Date: Thu, 19 May 2022 15:36:07 +0200 Subject: [PATCH] statsd: fix duplicate filename (#24595) --- selfdrive/statsd.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/selfdrive/statsd.py b/selfdrive/statsd.py index b880c4110a..5755e5111b 100755 --- a/selfdrive/statsd.py +++ b/selfdrive/statsd.py @@ -88,6 +88,7 @@ def main() -> NoReturn: # subscribe to deviceState for started state sm = SubMaster(['deviceState']) + idx = 0 last_flush_time = time.monotonic() gauges = {} samples: Dict[str, List[float]] = defaultdict(list) @@ -149,9 +150,10 @@ 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, str(int(current_time.timestamp()))) + stats_path = os.path.join(STATS_DIR, f"{current_time.timestamp():.0f}_{idx}") with atomic_write_in_dir(stats_path) as f: f.write(result) + idx += 1 else: cloudlog.error("stats dir full")