From 04ca721cf37c09b9888a6fcb55799f0d3f44805c Mon Sep 17 00:00:00 2001 From: Eduardo Blancas Date: Wed, 18 Sep 2024 11:30:42 -0600 Subject: [PATCH] removes telemetry --- src/soopervisor/cli.py | 65 ++++++++++-------------------------- src/soopervisor/telemetry.py | 6 ---- 2 files changed, 17 insertions(+), 54 deletions(-) delete mode 100644 src/soopervisor/telemetry.py diff --git a/src/soopervisor/cli.py b/src/soopervisor/cli.py index d1f9f42..b3d8b93 100644 --- a/src/soopervisor/cli.py +++ b/src/soopervisor/cli.py @@ -6,7 +6,6 @@ from soopervisor import config from soopervisor import exporter from soopervisor.enum import Backend, Mode -from soopervisor.telemetry import telemetry @click.group() @@ -39,34 +38,22 @@ def add(env_name, backend, preset): """ backend = Backend(backend) - try: - if Path("soopervisor.yaml").exists(): - cfg = yaml.safe_load(Path("soopervisor.yaml").read_text()) - if env_name in cfg: - raise click.ClickException( - f"A {env_name!r} section in the " - "soopervisor.yaml configuration file " - "already exists. Choose another name." - ) - if Path(env_name).exists(): + if Path("soopervisor.yaml").exists(): + cfg = yaml.safe_load(Path("soopervisor.yaml").read_text()) + if env_name in cfg: raise click.ClickException( - f"{env_name!r} already exists. Select a different name." + f"A {env_name!r} section in the " + "soopervisor.yaml configuration file " + "already exists. Choose another name." ) - except Exception as e: - telemetry.log_api( - "soopervisor_add_error", - metadata={"type": backend.value, "env_name": env_name, "error": str(e)}, + if Path(env_name).exists(): + raise click.ClickException( + f"{env_name!r} already exists. Select a different name." ) - raise Exporter = exporter.for_backend(backend) Exporter.new("soopervisor.yaml", env_name=env_name, preset=preset).add() - telemetry.log_api( - "soopervisor_add_success", - metadata={"type": backend.value, "env_name": env_name}, - ) - click.echo( "Environment added, to export it:\n" f"\t $ soopervisor export {env_name}\n" @@ -112,11 +99,6 @@ def export( backend = Backend(config.get_backend(env_name)) - telemetry.log_api( - "soopervisor_export_started", - metadata={"type": backend.value, "input_args": input_args}, - ) - until = None if until_build: @@ -129,27 +111,14 @@ def export( Exporter = exporter.for_backend(backend) - try: - Exporter.load("soopervisor.yaml", env_name=env_name, lazy_import=lazy).export( - mode=mode, - until=until, - skip_tests=skip_tests, - skip_docker=skip_docker, - ignore_git=ignore_git, - lazy_import=lazy, - task_name=task, - ) - - except Exception as e: - telemetry.log_api( - "soopervisor_export_error", - metadata={"type": backend.value, "input_args": input_args, "error": str(e)}, - ) - raise - - telemetry.log_api( - "soopervisor_export_success", - metadata={"type": backend.value, "input_args": input_args}, + Exporter.load("soopervisor.yaml", env_name=env_name, lazy_import=lazy).export( + mode=mode, + until=until, + skip_tests=skip_tests, + skip_docker=skip_docker, + ignore_git=ignore_git, + lazy_import=lazy, + task_name=task, ) diff --git a/src/soopervisor/telemetry.py b/src/soopervisor/telemetry.py deleted file mode 100644 index 347db8e..0000000 --- a/src/soopervisor/telemetry.py +++ /dev/null @@ -1,6 +0,0 @@ -from ploomber_core.telemetry.telemetry import Telemetry -from soopervisor import __version__ - -POSTHOG_API_KEY = "phc_P9SpSeypyPwxrMdFn2edOOEooQioF2axppyEeDwtMSP" - -telemetry = Telemetry(POSTHOG_API_KEY, "soopervisor", __version__)