Skip to content

Remove telemetry #1642

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

Merged
merged 1 commit into from
Feb 26, 2019
Merged
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
19 changes: 0 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,8 @@ regex = "1.0.1"
remove_dir_all = "0.5.1"
same-file = "1.0"
scopeguard = "0.3"
serde = { version = "1.0.87", features = ['derive'] }
serde_derive = "1.0"
serde_json = "1.0"
sha2 = "0.7.0"
tempdir = "0.3.4"
tempfile = "3.0.2"
term = "0.5.1"
time = "0.1.34"
toml = "0.4"
Expand Down
9 changes: 0 additions & 9 deletions src/rustup-cli/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
use crate::errors::*;
use crate::self_update;
use crate::term2;
use rustup::telemetry_analysis::TelemetryAnalysis;
use rustup::{Cfg, Notification, Toolchain, UpdateStatus};
use rustup_utils::notify::NotificationLevel;
use rustup_utils::utils;
Expand Down Expand Up @@ -433,11 +432,3 @@ pub fn report_error(e: &Error) {
false
}
}

pub fn show_telemetry(analysis: TelemetryAnalysis) -> Result<()> {
println!("Telemetry Analysis");

println!("{}", analysis);

Ok(())
}
2 changes: 1 addition & 1 deletion src/rustup-cli/proxy_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,5 @@ fn direct_proxy(
None => cfg.create_command_for_dir(&utils::current_dir()?, arg0)?,
Some(tc) => cfg.create_command_for_toolchain(tc, false, arg0)?,
};
Ok(run_command_for_dir(cmd, arg0, args, &cfg)?)
Ok(run_command_for_dir(cmd, arg0, args)?)
}
32 changes: 1 addition & 31 deletions src/rustup-cli/rustup_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use crate::help::*;
use crate::self_update;
use crate::term2;
use clap::{App, AppSettings, Arg, ArgGroup, ArgMatches, Shell, SubCommand};
use rustup::settings::TelemetryMode;
use rustup::{command, Cfg, Toolchain};
use rustup_dist::dist::{PartialTargetTriple, PartialToolchainDesc, TargetTriple};
use rustup_dist::manifest::Component;
Expand Down Expand Up @@ -71,12 +70,6 @@ pub fn main() -> Result<()> {
("uninstall", Some(m)) => self_uninstall(m)?,
(_, _) => unreachable!(),
},
("telemetry", Some(c)) => match c.subcommand() {
("enable", Some(_)) => set_telemetry(&cfg, TelemetryMode::On)?,
("disable", Some(_)) => set_telemetry(&cfg, TelemetryMode::Off)?,
("analyze", Some(_)) => analyze_telemetry(&cfg)?,
(_, _) => unreachable!(),
},
("set", Some(c)) => match c.subcommand() {
("default-host", Some(m)) => set_default_host_triple(&cfg, m)?,
(_, _) => unreachable!(),
Expand Down Expand Up @@ -453,17 +446,6 @@ pub fn cli() -> App<'static, 'static> {
SubCommand::with_name("upgrade-data").about("Upgrade the internal data format."),
),
)
.subcommand(
SubCommand::with_name("telemetry")
.about("rustup telemetry commands")
.setting(AppSettings::Hidden)
.setting(AppSettings::VersionlessSubcommands)
.setting(AppSettings::DeriveDisplayOrder)
.setting(AppSettings::SubcommandRequiredElseHelp)
.subcommand(SubCommand::with_name("enable").about("Enable rustup telemetry"))
.subcommand(SubCommand::with_name("disable").about("Disable rustup telemetry"))
.subcommand(SubCommand::with_name("analyze").about("Analyze stored telemetry")),
)
.subcommand(
SubCommand::with_name("set")
.about("Alter rustup settings")
Expand Down Expand Up @@ -630,7 +612,7 @@ fn run(cfg: &Cfg, m: &ArgMatches<'_>) -> Result<()> {
let args: Vec<_> = args.collect();
let cmd = cfg.create_command_for_toolchain(toolchain, m.is_present("install"), args[0])?;

let ExitCode(c) = command::run_command_for_dir(cmd, args[0], &args[1..], &cfg)?;
let ExitCode(c) = command::run_command_for_dir(cmd, args[0], &args[1..])?;

process::exit(c)
}
Expand Down Expand Up @@ -1025,18 +1007,6 @@ fn self_uninstall(m: &ArgMatches<'_>) -> Result<()> {
self_update::uninstall(no_prompt)
}

fn set_telemetry(cfg: &Cfg, t: TelemetryMode) -> Result<()> {
match t {
TelemetryMode::On => Ok(cfg.set_telemetry(true)?),
TelemetryMode::Off => Ok(cfg.set_telemetry(false)?),
}
}

fn analyze_telemetry(cfg: &Cfg) -> Result<()> {
let analysis = cfg.analyze_telemetry()?;
common::show_telemetry(analysis)
}

fn set_default_host_triple(cfg: &Cfg, m: &ArgMatches<'_>) -> Result<()> {
cfg.set_default_host_triple(m.value_of("host_triple").expect(""))?;
Ok(())
Expand Down
1 change: 0 additions & 1 deletion src/rustup-mock/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ tempdir = "0.3.4"
tar = "0.4.0"
toml = "0.4"
sha2 = "0.7.0"
wait-timeout = "0.1.3"

[target."cfg(windows)".dependencies]
winapi = "0.3"
Expand Down
23 changes: 1 addition & 22 deletions src/rustup-mock/src/clitools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@ use std::fs::{self, File};
use std::io::{self, Read, Write};
use std::mem;
use std::path::{Path, PathBuf};
use std::process::{Command, Stdio};
use std::process::Command;
use std::sync::Arc;
use std::time::Duration;
use tempdir::TempDir;
use url::Url;
use wait_timeout::ChildExt;

/// The configuration used by the tests in this module
pub struct Config {
Expand Down Expand Up @@ -253,25 +251,6 @@ pub fn expect_ok_contains(config: &Config, args: &[&str], stdout: &str, stderr:
}
}

pub fn expect_timeout_ok(config: &Config, timeout: Duration, args: &[&str]) {
let mut child = cmd(config, args[0], &args[1..])
.stdout(Stdio::null())
.stderr(Stdio::null())
.spawn()
.unwrap();

match child.wait_timeout(timeout).unwrap() {
Some(status) => {
assert!(status.success(), "not ok {:?}", args);
}
None => {
// child hasn't exited yet
child.kill().unwrap();
panic!("command timed out: {:?}", args);
}
}
}

fn print_command(args: &[&str], out: &SanitizedOutput) {
print!("\n>");
for arg in args {
Expand Down
12 changes: 0 additions & 12 deletions src/rustup-utils/src/toml_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,6 @@ pub fn get_bool(table: &mut toml::value::Table, key: &str, path: &str) -> Result
})
}

pub fn get_opt_bool(table: &mut toml::value::Table, key: &str, path: &str) -> Result<Option<bool>> {
if let Ok(v) = get_value(table, key, path) {
if let toml::Value::Boolean(b) = v {
Ok(Some(b))
} else {
Err(ErrorKind::ExpectedType("bool", path.to_owned() + key).into())
}
} else {
Ok(None)
}
}

pub fn get_table(
table: &mut toml::value::Table,
key: &str,
Expand Down
Loading