From 0347af18d69f5f3be6a8c0789400bacd3fff42b9 Mon Sep 17 00:00:00 2001 From: Dustin Byrne Date: Tue, 12 Nov 2024 16:50:07 -0500 Subject: [PATCH] fix: Prevent process recordings from clobbering one another AppMap data output via process recordings now contains the process ID in the file name to prevent multiple processes from quitting within the same second and overwriting each others data. --- _appmap/recording.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/_appmap/recording.py b/_appmap/recording.py index dadc958b..8513cbff 100644 --- a/_appmap/recording.py +++ b/_appmap/recording.py @@ -115,7 +115,9 @@ def save_at_exit(): nonlocal r r.stop() now = datetime.now(timezone.utc) - appmap_name = now.isoformat(timespec="seconds").replace("+00:00", "Z") + iso_time = now.isoformat(timespec="seconds").replace("+00:00", "Z") + process_id = os.getpid() + appmap_name = f"{iso_time}_{process_id}" recorder_type = "process" metadata = { "name": appmap_name,