Added telemetry system to get information about issues.
This commit is contained in:
@@ -13,10 +13,17 @@ def main() -> int:
|
||||
repair_container_host_after_update,
|
||||
)
|
||||
from .paths import AppPaths
|
||||
from .telemetry import initialize_shared_telemetry, shutdown_shared_telemetry
|
||||
from .umu import provision_umu_for_startup
|
||||
|
||||
telemetry = None
|
||||
telemetry_owner = False
|
||||
try:
|
||||
paths = AppPaths.from_environment()
|
||||
telemetry, telemetry_owner = initialize_shared_telemetry(
|
||||
paths,
|
||||
session_metadata={"interface": "gui", "command": "gui"},
|
||||
)
|
||||
# Older installed releases cannot run a bootstrap step that only exists
|
||||
# in their update payload. Their automatic restart enters here instead.
|
||||
provision_umu_for_startup(paths)
|
||||
@@ -36,13 +43,33 @@ def main() -> int:
|
||||
except KeyboardInterrupt:
|
||||
return 130
|
||||
except (ValueError, OSError, RuntimeError) as exc:
|
||||
if telemetry is not None:
|
||||
telemetry.report_exception(
|
||||
"launcher_exception",
|
||||
exc,
|
||||
metadata={"command": "gui"},
|
||||
context={"operation": "launcher", "stage": "startup"},
|
||||
)
|
||||
print(f"Error: {exc}", file=sys.stderr)
|
||||
return 1
|
||||
except BaseException as exc:
|
||||
if telemetry is not None:
|
||||
telemetry.report_exception(
|
||||
"launcher_exception",
|
||||
exc,
|
||||
metadata={"command": "gui"},
|
||||
context={"operation": "launcher", "stage": "startup"},
|
||||
severity="critical",
|
||||
)
|
||||
raise
|
||||
finally:
|
||||
if telemetry is not None and telemetry_owner:
|
||||
shutdown_shared_telemetry(telemetry)
|
||||
return 0
|
||||
|
||||
from .cli import main as cli_main
|
||||
|
||||
return cli_main(arguments)
|
||||
return cli_main(arguments, _manage_telemetry=True)
|
||||
|
||||
|
||||
raise SystemExit(main())
|
||||
|
||||
Reference in New Issue
Block a user