Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cell execution telemetry #2610

Draft
wants to merge 10 commits into
base: latest
Choose a base branch
from
25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ List of all notebooks is available in [index file](./notebooks/README.md).
- [To Launch all Notebooks](#to-launch-all-notebooks)
- [🧹 Cleaning Up](#-cleaning-up)
- [⚠️ Troubleshooting](#️-troubleshooting)
- [📊 Telemetry](#-telemetry)
- [📚 Additional Resources](#-additional-resources)
- [🧑‍💻 Contributors](#-contributors)
- [❓ FAQ](#-faq)
Expand Down Expand Up @@ -171,6 +172,30 @@ or create an [issue](https://github.com/openvinotoolkit/openvino_notebooks/issue
- If OpenVINO is installed globally, do not run installation commands in a terminal where `setupvars.bat` or `setupvars.sh` are sourced.
- For Windows installation, it is recommended to use _Command Prompt (`cmd.exe`)_, not _PowerShell_.

[![-----------------------------------------------------](https://user-images.githubusercontent.com/10940214/155750931-fc094349-b6ec-4e1f-9f9a-113e67941119.jpg)]()
<div id='-telemetry'></div>

## 📊 Telemetry

When you execute a notebook cell, telemetry data is collected to help us improve your experience.
This data only indicates that the cell was executed and does **not** include any personally identifiable information (PII).

By default, anonymous telemetry data is collected, limited solely to the execution of the notebook.
This telemetry does **not** extend to any Intel software, hardware, websites, or products.

If you prefer to disable telemetry, you can do so at any time by commenting out the specific line responsible for data collection in the notebook:
```python
# collect_telemetry()
```
Also you can disable telemetry collection by settting `SCARF_NO_ANALYTICS` or `DO_NOT_TRACK` environment variable to `true`:
```bash
export SCARF_NO_ANALYTICS=true
# or
export DO_NOT_TRACK=true
```

Scarf is used for telemetry purposes. Refer to [Scarf documentation](https://docs.scarf.sh/) to understand how the data is collected and processed.

[![-----------------------------------------------------](https://user-images.githubusercontent.com/10940214/155750931-fc094349-b6ec-4e1f-9f9a-113e67941119.jpg)]()
<div id='-additional-resource'></div>

Expand Down
7 changes: 5 additions & 2 deletions notebooks/hello-detection/hello-detection.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"id": "73d7aedb",
"metadata": {},
"outputs": [],
Expand All @@ -78,7 +78,10 @@
"\n",
"open(\"notebook_utils.py\", \"w\").write(r.text)\n",
"\n",
"from notebook_utils import download_file, device_widget"
"from notebook_utils import download_file, device_widget, collect_telemetry\n",
"\n",
"# Read more about telemetry collection at https://github.com/openvinotoolkit/openvino_notebooks?tab=readme-ov-file#-telemetry\n",
"collect_telemetry()"
]
},
{
Expand Down
7 changes: 5 additions & 2 deletions notebooks/hello-segmentation/hello-segmentation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
},
{
"cell_type": "code",
"execution_count": 2,
"execution_count": null,
"id": "485ef549",
"metadata": {},
"outputs": [],
Expand All @@ -77,7 +77,10 @@
"\n",
"open(\"notebook_utils.py\", \"w\").write(r.text)\n",
"\n",
"from notebook_utils import segmentation_map_to_image, download_file, device_widget"
"from notebook_utils import segmentation_map_to_image, download_file, device_widget, collect_telemetry\n",
"\n",
"# Read more about telemetry collection at https://github.com/openvinotoolkit/openvino_notebooks?tab=readme-ov-file#-telemetry\n",
"collect_telemetry()"
]
},
{
Expand Down
7 changes: 5 additions & 2 deletions notebooks/hello-world/hello-world.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
},
{
"cell_type": "code",
"execution_count": 1,
"execution_count": null,
"id": "41ee9436",
"metadata": {},
"outputs": [],
Expand All @@ -77,7 +77,10 @@
"\n",
"open(\"notebook_utils.py\", \"w\").write(r.text)\n",
"\n",
"from notebook_utils import download_file, device_widget"
"from notebook_utils import download_file, device_widget, collect_telemetry\n",
"\n",
"# Read more about telemetry collection at https://github.com/openvinotoolkit/openvino_notebooks?tab=readme-ov-file#-telemetry\n",
"collect_telemetry()"
]
},
{
Expand Down
7 changes: 6 additions & 1 deletion notebooks/object-detection-webcam/object-detection.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@
" url=\"https://raw.githubusercontent.com/openvinotoolkit/openvino_notebooks/latest/utils/notebook_utils.py\",\n",
")\n",
"\n",
"open(\"notebook_utils.py\", \"w\").write(r.text)"
"open(\"notebook_utils.py\", \"w\").write(r.text)\n",
"\n",
"from notebook_utils import collect_telemetry\n",
"\n",
"# Read more about telemetry collection at https://github.com/openvinotoolkit/openvino_notebooks?tab=readme-ov-file#-telemetry\n",
"collect_telemetry()"
]
},
{
Expand Down
6 changes: 6 additions & 0 deletions notebooks/pose-estimation-webcam/pose-estimation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@
")\n",
"\n",
"open(\"notebook_utils.py\", \"w\").write(r.text)\n",
"\n",
"from notebook_utils import collect_telemetry\n",
"\n",
"# Read more about telemetry collection at https://github.com/openvinotoolkit/openvino_notebooks?tab=readme-ov-file#-telemetry\n",
"collect_telemetry()\n",
"\n",
"import notebook_utils as utils"
]
},
Expand Down
26 changes: 26 additions & 0 deletions utils/notebook_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -714,3 +714,29 @@ def optimize_bge_embedding(model_path, output_model_path):
manager.register_pass(ReplaceTensor(packed_layername_tensor_dict_list))
manager.run_passes(ov_model)
ov.save_model(ov_model, output_model_path, compress_to_fp16=False)


def collect_telemetry(filename: str = ""):
"""
The function only tracks that the notebooks cell was executed and does not include any personally identifiable information (PII).
"""
try:
import os
import requests
import platform
from pathlib import Path

if os.getenv("SCARF_NO_ANALYTICS") == "true" or os.getenv("DO_NOT_TRACK") == "true":
return
url = "https://openvino.gateway.scarf.sh/telemetry"
params = {
"notebook_dir": Path(__file__).parent.name,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can collect notebook directory assuming that each notebook downloads notebook_utils.py file to the same directory.

"platform": platform.system(),
"arch": platform.machine(),
"python_version": platform.python_version(),
}
if filename:
params["file"] = filename
requests.get(url, params=params)
except Exception:
pass
Loading