mirror of
https://github.com/deepset-ai/haystack.git
synced 2025-09-25 16:15:35 +00:00
fix: disabling telemetry prevents writing config (#3465)
* fix: disabling telemetry prevents writing config * set user id to empty string if telemetry disabled * Update haystack/telemetry.py * set id to None instead of "" in error case * remove RuntimeError if user id is not set * Revert "remove RuntimeError if user id is not set" This reverts commit c59f06d47216afa7ada6199b03f1b09a2b936c02. Co-authored-by: Sara Zan <sara.zanzottera@deepset.ai>
This commit is contained in:
parent
d48577b4e7
commit
6a422d588f
@ -207,15 +207,16 @@ def send_tutorial_event(url: str):
|
||||
send_custom_event(event=f"tutorial {dataset_url_to_tutorial.get(url, '?')} executed")
|
||||
|
||||
|
||||
def _get_or_create_user_id() -> str:
|
||||
def _get_or_create_user_id() -> Optional[str]:
|
||||
"""
|
||||
Randomly generates a user id or loads the id defined in the config file and returns it.
|
||||
Returns None if no id has been set previously and a new one cannot be stored because telemetry is disabled
|
||||
"""
|
||||
global user_id # pylint: disable=global-statement
|
||||
if user_id is None:
|
||||
# if user_id is not set, read it from config file
|
||||
_read_telemetry_config()
|
||||
if user_id is None:
|
||||
if user_id is None and is_telemetry_enabled():
|
||||
# if user_id cannot be read from config file, create new user_id and write it to config file
|
||||
user_id = str(uuid.uuid4())
|
||||
_write_telemetry_config()
|
||||
|
Loading…
x
Reference in New Issue
Block a user