-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #52 from AgentOps-AI/telemetry
Telemetry and Run
- Loading branch information
Showing
6 changed files
with
101 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# hi :) | ||
# | ||
# if you're reading this, you probably saw "telemetry.py" and | ||
# got mad and went to go see how we're spying on you | ||
# | ||
# i really hate to put this functionality in and was very | ||
# resistant to it. as a human, i value privacy as a fundamental | ||
# human right. but i also value my time. | ||
# | ||
# i have been putting a lot of my time into building out | ||
# agentstack. i have strong conviction for what this project | ||
# can be. it's showing some great progress, but for me to justify | ||
# spending days and nights building this, i need to know that | ||
# people are actually using it and not just starring the repo | ||
# | ||
# if you want to opt-out of telemetry, you can add the following | ||
# configuration to your agentstack.json file: | ||
# | ||
# telemetry_opt_out: false | ||
# | ||
# i'm a single developer with a passion, working to lower the barrier | ||
# of entry to building and deploying agents. it would be really | ||
# cool of you to allow telemetry <3 | ||
# | ||
# - braelyn | ||
|
||
import platform | ||
import socket | ||
import psutil | ||
import requests | ||
from agentstack.utils import get_telemetry_opt_out, get_framework, get_version | ||
|
||
# TELEMETRY_URL = 'https://api.agentstack.sh/telemetry' | ||
TELEMETRY_URL = 'http://localhost:3000/telemetry' | ||
|
||
def collect_machine_telemetry(): | ||
if get_telemetry_opt_out(): | ||
return | ||
|
||
telemetry_data = { | ||
'os': platform.system(), | ||
'hostname': socket.gethostname(), | ||
'platform': platform.platform(), | ||
'os_version': platform.version(), | ||
'cpu_count': psutil.cpu_count(logical=True), | ||
'memory': psutil.virtual_memory().total, | ||
'framework': get_framework(), | ||
'agentstack_version': get_version() | ||
} | ||
|
||
# Attempt to get general location based on public IP | ||
try: | ||
response = requests.get('https://ipinfo.io/json') | ||
if response.status_code == 200: | ||
location_data = response.json() | ||
telemetry_data.update({ | ||
'ip': location_data.get('ip'), | ||
'city': location_data.get('city'), | ||
'region': location_data.get('region'), | ||
'country': location_data.get('country') | ||
}) | ||
except requests.RequestException as e: | ||
telemetry_data['location_error'] = str(e) | ||
|
||
return telemetry_data | ||
|
||
|
||
def track_cli_command(command): | ||
try: | ||
data = collect_machine_telemetry() | ||
requests.post(TELEMETRY_URL, json={"command": command, **data}) | ||
except: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" | |
|
||
[project] | ||
name = "agentstack" | ||
version = "0.1.9" | ||
version = "0.1.10" | ||
description = "The fastest way to build robust AI agents" | ||
authors = [ | ||
{ name="Braelyn Boynton", email="[email protected]" } | ||
|