Skip to content

Commit ee89850

Browse files
authored
Remove telemetry from code (#1)
* remove all telemetry code * allow manual override of system type https://community.platformio.org/t/windows-on-arm64-problem-installing-xtensa-toolchain/25497
1 parent 9eb6e51 commit ee89850

File tree

10 files changed

+12
-427
lines changed

10 files changed

+12
-427
lines changed

README.rst

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,11 @@ Contributing
8282

8383
See `contributing guidelines <https://github.com/platformio/platformio/blob/develop/CONTRIBUTING.md>`_.
8484

85-
Telemetry / Privacy Policy
86-
--------------------------
85+
Telemetry
86+
---------
8787

88-
Share minimal diagnostics and usage information to help us make PlatformIO better.
89-
It is enabled by default. For more information see:
88+
Removed
9089

91-
* `Telemetry Setting <https://docs.platformio.org/en/latest/userguide/cmd_settings.html?utm_source=github&utm_medium=core#enable-telemetry>`_
9290

9391
License
9492
-------

platformio/__main__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ def main(argv=None):
106106
exit_code = int(exc.code)
107107
except Exception as exc: # pylint: disable=broad-except
108108
if not isinstance(exc, exception.ReturnErrorCode):
109-
maintenance.on_platformio_exception(exc)
110109
error_str = f"{exc.__class__.__name__}: "
111110
if isinstance(exc, exception.PlatformioException):
112111
error_str += str(exc)
@@ -131,7 +130,6 @@ def main(argv=None):
131130
click.secho(error_str, fg="red", err=True)
132131
exit_code = int(str(exc)) if str(exc).isdigit() else 1
133132

134-
maintenance.on_platformio_exit()
135133
sys.argv = prev_sys_argv
136134
return exit_code
137135

platformio/app.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ def projects_dir_validate(projects_dir):
4646
"description": "Enable caching for HTTP API requests",
4747
"value": True,
4848
},
49-
"enable_telemetry": {
50-
"description": ("Telemetry service <https://bit.ly/pio-telemetry> (Yes/No)"),
51-
"value": True,
52-
},
5349
"force_verbose": {
5450
"description": "Force verbose output when processing environments",
5551
"value": False,
@@ -69,7 +65,6 @@ def projects_dir_validate(projects_dir):
6965
"command_ctx": None,
7066
"caller_id": None,
7167
"custom_project_conf": None,
72-
"pause_telemetry": False,
7368
}
7469

7570

@@ -274,8 +269,6 @@ def get_user_agent():
274269
data.append("IDE/%s" % os.getenv("PLATFORMIO_IDE"))
275270
data.append("Python/%s" % platform.python_version())
276271
data.append("Platform/%s" % platform.platform())
277-
if not get_setting("enable_telemetry"):
278-
data.append("Telemetry/0")
279272
return " ".join(data)
280273

281274

platformio/debug/process/gdb.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@
1616
import signal
1717
import time
1818

19-
from platformio import telemetry
2019
from platformio.compat import aio_get_running_loop, is_bytes
2120
from platformio.debug import helpers
22-
from platformio.debug.exception import DebugInitError
2321
from platformio.debug.process.client import DebugClientProcess
2422

2523

@@ -130,7 +128,6 @@ def stdout_data_received(self, data):
130128
self._handle_error(data)
131129
# go to init break automatically
132130
if self.INIT_COMPLETED_BANNER.encode() in data:
133-
telemetry.log_debug_started(self.debug_config)
134131
self._auto_exec_continue()
135132

136133
def console_log(self, msg):
@@ -175,7 +172,4 @@ def _handle_error(self, data):
175172
and b"Error in sourced" in self._errors_buffer
176173
):
177174
return
178-
telemetry.log_debug_exception(
179-
DebugInitError(self._errors_buffer.decode()), self.debug_config
180-
)
181175
self.transport.close()

platformio/maintenance.py

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import click
2020
import semantic_version
2121

22-
from platformio import __version__, app, exception, fs, telemetry
22+
from platformio import __version__, app, exception, fs
2323
from platformio.cache import cleanup_content_cache
2424
from platformio.cli import PlatformioCLI
2525
from platformio.commands.upgrade import get_latest_version
@@ -32,7 +32,6 @@
3232
def on_cmd_start(ctx, caller):
3333
app.set_session_var("command_ctx", ctx)
3434
set_caller(caller)
35-
telemetry.on_cmd_start(ctx)
3635
if PlatformioCLI.in_silence():
3736
return
3837
after_upgrade(ctx)
@@ -57,14 +56,6 @@ def on_cmd_end():
5756
)
5857

5958

60-
def on_platformio_exception(exc):
61-
telemetry.log_exception(exc)
62-
63-
64-
def on_platformio_exit():
65-
telemetry.on_exit()
66-
67-
6859
def set_caller(caller=None):
6960
caller = caller or os.getenv("PLATFORMIO_CALLER")
7061
if not caller:
@@ -103,7 +94,6 @@ def _appstate_migration(_):
10394
state_path = app.resolve_state_path("core_dir", "appstate.json")
10495
if not os.path.isfile(state_path):
10596
return True
106-
app.delete_state_item("telemetry")
10797
created_at = app.get_state_item("created_at", None)
10898
if not created_at:
10999
state_stat = os.stat(state_path)
@@ -160,14 +150,6 @@ def after_upgrade(ctx):
160150
"PlatformIO has been successfully upgraded to %s!\n" % __version__,
161151
fg="green",
162152
)
163-
telemetry.log_event(
164-
"pio_upgrade_core",
165-
{
166-
"label": "%s > %s" % (last_version_str, __version__),
167-
"from_version": last_version_str,
168-
"to_version": __version__,
169-
},
170-
)
171153

172154
return print_welcome_banner()
173155

platformio/platform/_run.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
import click
2323

24-
from platformio import app, fs, proc, telemetry
24+
from platformio import app, fs, proc
2525
from platformio.compat import hashlib_encode_data
2626
from platformio.package.manager.core import get_core_package_dir
2727
from platformio.platform.exception import BuildScriptNotFound
@@ -60,7 +60,6 @@ def run( # pylint: disable=too-many-arguments
6060
if not os.path.isfile(variables["build_script"]):
6161
raise BuildScriptNotFound(variables["build_script"])
6262

63-
telemetry.log_platform_run(self, self.config, variables["pioenv"], targets)
6463
result = self._run_scons(variables, targets, jobs)
6564

6665
assert "returncode" in result

platformio/project/helpers.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ def load_build_metadata(project_dir, env_or_envs, cache=False, build_type=None):
164164

165165
def _load_build_metadata(project_dir, env_names, build_type=None):
166166
# pylint: disable=import-outside-toplevel
167-
from platformio import app
168167
from platformio.run.cli import cli as cmd_run
169168

170169
args = ["--project-dir", project_dir, "--target", "__idedata"]
@@ -174,9 +173,7 @@ def _load_build_metadata(project_dir, env_names, build_type=None):
174173
# args.extend(["--target", "__test"])
175174
for name in env_names:
176175
args.extend(["-e", name])
177-
app.set_session_var("pause_telemetry", True)
178176
result = CliRunner().invoke(cmd_run, args)
179-
app.set_session_var("pause_telemetry", False)
180177
if result.exit_code != 0 and not isinstance(
181178
result.exception, exception.ReturnErrorCode
182179
):

platformio/remote/client/base.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
from twisted.spread import pb # pylint: disable=import-error
2626
from zope.interface import provider # pylint: disable=import-error
2727

28-
from platformio import __pioremote_endpoint__, __version__, app, exception, maintenance
28+
from platformio import __pioremote_endpoint__, __version__, app, exception
2929
from platformio.remote.factory.client import RemoteClientFactory
3030
from platformio.remote.factory.ssl import SSLContextFactory
3131

@@ -186,7 +186,5 @@ def cb_global_error(self, err):
186186
"a remote machine using `pio remote agent start` command.\n"
187187
"See http://docs.platformio.org/page/plus/pio-remote.html"
188188
)
189-
else:
190-
maintenance.on_platformio_exception(Exception(err.type))
191189
click.secho(msg, fg="red", err=True)
192190
self.disconnect(exit_code=1)

0 commit comments

Comments
 (0)