kedro-org / kedro-plugins

First-party plugins maintained by the Kedro team.
Apache License 2.0
93 stars 89 forks source link

`kedro-telemetry` fix failing to send telemetry when user UUID not found #815

Closed astrojuanlu closed 1 month ago

astrojuanlu commented 2 months ago

Description

If the user UUID is malformed for some reason, telemetry data should still be send, but instead with an "anonymous" or empty UUID.

Context

How has this bug affected you? What were you trying to accomplish?

Steps to Reproduce

$ cat (python -c "from appdirs import user_config_dir as u; print(u('kedro'))")/telemetry.toml
[telemetry]
uuid = ""

Expected Result

Nothing

Actual Result

$ uv run kedro registry list
[08/23/24 18:13:54] INFO     Using                                                                        __init__.py:249
                             '/private/tmp/kedro-telemetry-test-starter/.venv/lib/python3.12/site-package                
                             s/kedro/framework/project/rich_logging.yml' as logging configuration.                       
[08/23/24 18:13:56] ERROR    Failed to retrieve UUID: badly formed hexadecimal UUID string                   plugin.py:81
- __default__

                    INFO     Kedro is sending anonymous usage data with the sole purpose of improving the   plugin.py:233
                             product. No personal data or IP addresses are stored on our side. If you want               
                             to opt out, set the `KEDRO_DISABLE_TELEMETRY` or `DO_NOT_TRACK` environment                 
                             variables, or create a `.telemetry` file in the current working directory with              
                             the contents `consent: false`. Read more at                                                 
                             https://docs.kedro.org/en/stable/configuration/telemetry.html                               
[08/23/24 18:13:57] WARNING  Failed to send data to Heap. Response code returned: 400, Response reason: Bad plugin.py:336
                             Request
astrojuanlu commented 2 months ago

This issue is about finding out why the Heap request fails. Several things not specifically related to it:

astrojuanlu commented 2 months ago

I was quite misguided, the problem was with the user UUID and not the project UUID. I changed the body accordingly.