Add more params for scarf (#1720)

Allow to slice on further metrics
This commit is contained in:
Trevor Bossert 2023-10-11 17:09:19 -07:00 committed by GitHub
parent 8ab40c20c1
commit 569561e59b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 38 additions and 8 deletions

View File

@ -1,4 +1,4 @@
## 0.10.22-dev1
## 0.10.22-dev2
### Enhancements

View File

@ -1 +1 @@
__version__ = "0.10.22-dev1" # pragma: no cover
__version__ = "0.10.22-dev2" # pragma: no cover

View File

@ -3,6 +3,7 @@ import importlib
import json
import os
import platform
import subprocess
from datetime import datetime
from functools import wraps
from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union, cast
@ -197,13 +198,42 @@ def validate_date_args(date: Optional[str] = None):
def scarf_analytics():
try:
subprocess.check_output("nvidia-smi")
gpu_present = True
except Exception:
gpu_present = False
pass
try:
if os.getenv("SCARF_NO_ANALYTICS") != "true" and os.getenv("DO_NOT_TRACK") != "true":
requests.get(
"https://packages.unstructured.io/python-telemetry?version="
+ __version__
+ "&platform="
+ platform.system()
)
if "dev" in __version__:
requests.get(
"https://packages.unstructured.io/python-telemetry?version="
+ __version__
+ "&platform="
+ platform.system()
+ "&python"
+ platform.python_version()
+ "&arch="
+ platform.machine()
+ "&gpu="
+ str(gpu_present)
+ "&dev=true"
)
else:
requests.get(
"https://packages.unstructured.io/python-telemetry?version="
+ __version__
+ "&platform="
+ platform.system()
+ "&python"
+ platform.python_version()
+ "&arch="
+ platform.machine()
+ "&gpu="
+ str(gpu_present)
+ "&dev=false"
)
except Exception:
pass