Skip to content

Commit 2148671

Browse files
committed
dont error from telemetry on init
1 parent 281fc3a commit 2148671

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

agentstack/telemetry.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
TELEMETRY_URL = 'https://api.agentstack.sh/telemetry'
3434

35-
def collect_machine_telemetry():
35+
def collect_machine_telemetry(command: str):
3636
if get_telemetry_opt_out():
3737
return
3838

@@ -43,10 +43,14 @@ def collect_machine_telemetry():
4343
'os_version': platform.version(),
4444
'cpu_count': psutil.cpu_count(logical=True),
4545
'memory': psutil.virtual_memory().total,
46-
'framework': get_framework(),
4746
'agentstack_version': get_version()
4847
}
4948

49+
if command is not "init":
50+
telemetry_data['framework'] = get_framework()
51+
else:
52+
telemetry_data['framework'] = "n/a"
53+
5054
# Attempt to get general location based on public IP
5155
try:
5256
response = requests.get('https://ipinfo.io/json')
@@ -64,9 +68,9 @@ def collect_machine_telemetry():
6468
return telemetry_data
6569

6670

67-
def track_cli_command(command):
71+
def track_cli_command(command: str):
6872
try:
69-
data = collect_machine_telemetry()
73+
data = collect_machine_telemetry(command)
7074
requests.post(TELEMETRY_URL, json={"command": command, **data})
7175
except:
7276
pass

0 commit comments

Comments
 (0)