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

kedro-telemetry: Environment var do not override the consent from the .telemetry if not command run case #785

Closed
ElenaKhaustova opened this issue Jul 25, 2024 · 2 comments
Assignees

Comments

@ElenaKhaustova
Copy link
Contributor

ElenaKhaustova commented Jul 25, 2024

Description

Relates to #762 and kedro-org/kedro#4024

Context

We call _check_for_telemetry_consent before each command run. However, in the rest of the cases, we call _check_for_telemetry_consent after the context is created but we also check if self._consent was not set:

It makes it impossible to override the consent from the .telemetry by setting the environment variable ("DO_NOT_TRACK" or "KEDRO_DISABLE_TELEMETRY") for example in interactive environments.

Steps to Reproduce

  1. create .telemetry with consent: true
  2. kedro ipython
  3. consent in .telemetry is set to true, telemetry is sent (as expected}
  4. set os.environ["DO_NOT_TRACK"] = "true"
  5. %reload_ext kedro.ipython
  6. consent in .telemetry is set to true, os.environ["DO_NOT_TRACK"] is true, telemetry is still sent (not expected)

The same issue if changing .telemetry in interactive environment:

  1. create .telemetry with consent: true
  2. kedro ipython
  3. consent in .telemetry is set to true, telemetry is sent (as expected}
  4. update .telemetry with consent: false
  5. %reload_ext kedro.ipython
  6. consent in .telemetry is set to false, telemetry is still sent (not expected)
@lrcouto
Copy link
Contributor

lrcouto commented Jul 30, 2024

On #791 I tried to change the after_context_created hook to always set self._consent insead of only when it's None. It stops further unwanted calls every time we reload IPython with the DO_NOT_TRACK variable set. However, it still sends info to heap after the IPython shell is exited.

If you edit the .telemetry file itself inside IPython, it still sends info to heap once, because when the command was first called consent was true. I think this is a weird behavior. I'm looking into it further.

@astrojuanlu astrojuanlu moved this from In Progress to In Review in Kedro Framework Jul 31, 2024
@ElenaKhaustova
Copy link
Contributor Author

However, it still sends info to heap after the IPython shell is exited.

I think that's fine because the environment variable is set for the IPython shell, so that's the expected behaviour.

If you edit the .telemetry file itself inside IPython, it still sends info to heap once

This one also seems fine to me, as we give an option on how to disable it completely with .telemetry before the run. But if users forget - they still can do it inside IPython.

So, I would go ahead with the suggested fix.

@github-project-automation github-project-automation bot moved this from In Review to Done in Kedro Framework Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

2 participants