Skip to content

Commit

Permalink
removes telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
edublancas committed Sep 18, 2024
1 parent 06e6b1e commit 04ca721
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 54 deletions.
65 changes: 17 additions & 48 deletions src/soopervisor/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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:
Expand All @@ -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,
)


Expand Down
6 changes: 0 additions & 6 deletions src/soopervisor/telemetry.py

This file was deleted.

0 comments on commit 04ca721

Please sign in to comment.