-
Notifications
You must be signed in to change notification settings - Fork 236
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add telemetry features. * feat: add analytics to streamlit app * docs: Add analytics information to the documentation. * fix: fix issues related with imports * fix: add request * fix: remove print * fix: cleaning code --------- Co-authored-by: Fabiana Clemente <fabianaclemente@Fabianas-MacBook-Air.local>
- Loading branch information
Showing
7 changed files
with
121 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
|
||
# Analytics & Telemetry | ||
|
||
## Overview | ||
|
||
`ydata-synthetic` is a powerful library designed to generate synthetic data. | ||
As part of our ongoing efforts to improve user experience and functionality, `ydata-synthetic` | ||
includes a telemetry feature. This feature collects anonymous usage data, helping us understand | ||
how the library is used and identify areas for improvement. | ||
|
||
The primary goal of collecting telemetry data is to: | ||
|
||
- Enhance the functionality and performance of the ydata-synthetic library | ||
- Prioritize new features based on user engagement | ||
- Identify common issues and bugs to improve overall user experience | ||
|
||
### Data Collected | ||
The telemetry system collects non-personal, anonymous information such as: | ||
|
||
- Python version | ||
- `ydata-synthetic` version | ||
- Frequency of use of `ydata-synthetic` features | ||
- Errors or exceptions thrown within the library | ||
|
||
## Disabling usage analytics | ||
|
||
We respect your choice to not participate in our telemetry collection. | ||
If you prefer to disable telemetry, you can do so by setting an environment | ||
variable on your system. Disabling telemetry will not affect the functionality | ||
of the ydata-profiling library, except for the ability to contribute to its usage analytics. | ||
|
||
### Set an Environment Variable | ||
In your notebook or script make sure to set YDATA_SYNTHETIC_NO_ANALYTICS | ||
environment variable to `True`. | ||
|
||
````python | ||
import os | ||
|
||
os.environ['YDATA_SYNTHETIC_NO_ANALYTICS']='True' | ||
```` | ||
|
||
|
||
|
||
|
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
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,23 @@ | ||
""" | ||
ydata-synthetic logger | ||
""" | ||
from __future__ import absolute_import, division, print_function | ||
|
||
import logging | ||
|
||
from ydata_synthetic.utils.utils import analytics_features | ||
|
||
class SynthesizersLogger(logging.Logger): | ||
def __init__(self, name, level=logging.INFO): | ||
super().__init__(name, level) | ||
|
||
def info( | ||
self, | ||
msg: object, | ||
) -> None: | ||
super().info(f'[SYNTHESIZER] - {msg}.') | ||
|
||
def info_def_report(self, model: str): | ||
analytics_features(model=model) | ||
|
||
super().info(f'[SYNTHESIZER] Creating a synthetic data generator with the following model - {model}.') |
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,32 @@ | ||
""" | ||
Utility functions that are common to ydata-synthetic project | ||
""" | ||
import os | ||
import subprocess | ||
import platform | ||
import requests | ||
|
||
from ydata_synthetic.version import __version__ | ||
def analytics_features(model: str): | ||
endpoint= "https://packages.ydata.ai/ydata-synthetic?" | ||
|
||
if bool(os.getenv("YDATA_SYNTHETIC_NO_ANALYTICS"))!= True: | ||
package_version = __version__ | ||
try: | ||
subprocess.check_output("nvidia-smi") | ||
gpu_present = True | ||
except Exception: | ||
gpu_present = False | ||
|
||
python_version = ".".join(platform.python_version().split(".")[:2]) | ||
|
||
try: | ||
request_message = f"{endpoint}version={package_version}" \ | ||
f"&python_version={python_version}" \ | ||
f"&model={model}" \ | ||
f"&os={platform.system()}" \ | ||
f"&gpu={str(gpu_present)}" | ||
|
||
requests.get(request_message) | ||
except Exception: | ||
pass |