From 48a344bc6d00a0126767e7683e8a27a13af1af85 Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Mon, 12 Aug 2024 16:21:46 -0700 Subject: [PATCH] feat: Add system information to all events --- aider/analytics.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/aider/analytics.py b/aider/analytics.py index 163fed271..31a43dc8f 100644 --- a/aider/analytics.py +++ b/aider/analytics.py @@ -1,5 +1,7 @@ import json import uuid +import sys +import platform from pathlib import Path from mixpanel import Mixpanel @@ -17,6 +19,14 @@ class Analytics: self.mp = Mixpanel(project_token) if project_token else None self.user_id = self.get_or_create_uuid() + def get_system_info(self): + return { + "python_version": sys.version.split()[0], + "os_platform": platform.system(), + "os_release": platform.release(), + "machine": platform.machine() + } + def get_or_create_uuid(self): uuid_file = Path.home() / ".aider" / "caches" / "mixpanel-uuid.json" uuid_file.parent.mkdir(parents=True, exist_ok=True) @@ -36,6 +46,7 @@ class Analytics: if properties is None: properties = {} properties.update(kwargs) + properties.update(self.get_system_info()) # Add system info to all events # Handle numeric values for key, value in properties.items():