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

Remove analytics reporting from pebble-tool #50

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions pebble_tool/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

from .exceptions import ToolError
from .sdk import sdk_version
from .util.analytics import wait_for_analytics, analytics_prompt
from .util.config import config
from .util.updates import wait_for_update_checks
from .util.wsl import maybe_apply_wsl_hacks
Expand All @@ -29,7 +28,6 @@ def run_tool(args=None):
urllib3.disable_warnings() # sigh. :(
logging.basicConfig()
maybe_apply_wsl_hacks()
analytics_prompt()
parser = argparse.ArgumentParser(description="Pebble Tool", prog="pebble",
epilog="For help on an individual command, call that command with --help.")
version_string = "Pebble Tool v{}".format(__version__)
Expand All @@ -49,9 +47,5 @@ def run_tool(args=None):

@atexit.register
def wait_for_cleanup():
import time
now = time.time()
wait_for_analytics(2)
wait_for_update_checks(2)
logging.info("Spent %f seconds waiting for analytics.", time.time() - now)
config.save()
2 changes: 0 additions & 2 deletions pebble_tool/commands/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from pebble_tool.sdk import pebble_platforms, sdk_version
from pebble_tool.sdk.emulator import ManagedEmulatorTransport, get_all_emulator_info
from pebble_tool.sdk.cloudpebble import CloudPebbleTransport
from pebble_tool.util.analytics import post_event

_CommandRegistry = []

Expand Down Expand Up @@ -55,7 +54,6 @@ def _shared_parser(cls):

def __call__(self, args):
self._set_debugging(args.v)
post_event("invoke_command_{}".format(self.command))

def _set_debugging(self, level):
self._verbosity = level
Expand Down
3 changes: 0 additions & 3 deletions pebble_tool/commands/sdk/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from . import SDKCommand
from pebble_tool.sdk import SDK_VERSION, sdk_version
from pebble_tool.exceptions import ToolError
from pebble_tool.util.analytics import post_event
from pebble_tool.util.versions import version_to_key


Expand Down Expand Up @@ -162,7 +161,6 @@ def __call__(self, args):

_copy_from_template(template_layout, extant_path(template_paths), args.name, options)

post_event("sdk_create_project", javascript=args.javascript or args.rocky, worker=args.worker, rocky=args.rocky)
print("Created new project {}".format(args.name))

@classmethod
Expand Down Expand Up @@ -201,7 +199,6 @@ def __call__(self, args):

_copy_from_template(template_layout, template_path, args.name, options)

post_event("sdk_create_package", javascript=args.javascript)
print("Created new package {}".format(args.name))

@classmethod
Expand Down
13 changes: 1 addition & 12 deletions pebble_tool/commands/sdk/project/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from pebble_tool.exceptions import (PebbleProjectException, InvalidJSONException, InvalidProjectException,
OutdatedProjectException)
from pebble_tool.sdk.project import PebbleProject
from pebble_tool.util.analytics import post_event
from pebble_tool.commands.sdk import SDKCommand

logger = logging.getLogger("pebble_tool.commands.sdk")
Expand Down Expand Up @@ -41,14 +40,4 @@ def _waf(self, command, extra_env=None, args=None):

def __call__(self, args):
super(SDKProjectCommand, self).__call__(args)
try:
self.project = PebbleProject()
except PebbleProjectException as e:
event_map = {
InvalidProjectException: "sdk_run_without_project",
InvalidJSONException: "sdk_json_error",
OutdatedProjectException: "sdk_json_error",
}
if type(e) in event_map:
post_event(event_map[type(e)])
raise
self.project = PebbleProject()
9 changes: 0 additions & 9 deletions pebble_tool/commands/sdk/project/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import time

from pebble_tool.exceptions import BuildError
from pebble_tool.util.analytics import post_event
import pebble_tool.util.npm as npm
from pebble_tool.commands.sdk.project import SDKProjectCommand

Expand All @@ -20,12 +19,10 @@ def __call__(self, args):
super(BuildCommand, self).__call__(args)
start_time = time.time()
if len(self.project.dependencies) > 0:
post_event('app_build_with_npm_deps')
try:
npm.invoke_npm(["install"])
npm.invoke_npm(["dedupe"])
except subprocess.CalledProcessError:
post_event("app_build_failed_npm")
raise BuildError("npm failed.")
try:
waf = list(args.args)
Expand All @@ -39,13 +36,7 @@ def __call__(self, args):
self._waf("configure", extra_env=extra_env, args=waf)
self._waf("build", args=waf)
except subprocess.CalledProcessError:
duration = time.time() - start_time
post_event("app_build_failed", build_time=duration)
raise BuildError("Build failed.")
else:
duration = time.time() - start_time
has_js = os.path.exists(os.path.join('src', 'js'))
post_event("app_build_succeeded", has_js=has_js, line_counts=self._get_line_counts(), build_time=duration)

@classmethod
def _get_line_counts(cls):
Expand Down
3 changes: 0 additions & 3 deletions pebble_tool/sdk/emulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

from pebble_tool.account import get_default_account
from pebble_tool.exceptions import MissingEmulatorError, ToolError
from pebble_tool.util.analytics import post_event
from . import sdk_path, get_sdk_persist_dir, sdk_manager

logger = logging.getLogger("pebble_tool.sdk.emulator")
Expand Down Expand Up @@ -249,7 +248,6 @@ def _wait_for_qemu(self):
else:
break
else:
post_event("qemu_launched", success=False, reason="qemu_launch_timeout")
raise ToolError("Emulator launch timed out.")
received = b''
while True:
Expand All @@ -262,7 +260,6 @@ def _wait_for_qemu(self):
if b"<SDK Home>" in received or b"<Launcher>" in received or b"Ready for communication" in received:
break
s.close()
post_event("qemu_launched", success=True)
logger.info("Firmware booted.")

def _copy_spi_image(self, path):
Expand Down
245 changes: 0 additions & 245 deletions pebble_tool/util/analytics.py

This file was deleted.

Loading