mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 17:24:59 +00:00
feat: Add system information to all events
This commit is contained in:
parent
f110e8c8db
commit
48a344bc6d
1 changed files with 11 additions and 0 deletions
|
@ -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():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue