Skip to content

Commit

Permalink
Cleanup telemetry anonymous ID
Browse files Browse the repository at this point in the history
  • Loading branch information
brynary committed Nov 19, 2024
1 parent a3a3584 commit 3b4773e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 23 deletions.
2 changes: 1 addition & 1 deletion qlty-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ pub fn run_command_line() {
let arguments = Arguments::parse();
debug!("Arguments: {:?}", arguments);

let telemetry = Telemetry::new(&command, start_time, repository_path.clone(), None);
let telemetry = Telemetry::new(&command, start_time, repository_path.clone());
setup_panic_hook(telemetry.clone());

let result = arguments.execute();
Expand Down
13 changes: 3 additions & 10 deletions qlty-cli/src/telemetry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ const DETACHED_PROCESS: u32 = 0x00000008;

#[derive(Clone)]
pub struct Telemetry {
user_id: Option<String>,
command: String,
pub start_time: Instant,
repository_path: Option<PathBuf>,
Expand All @@ -45,14 +44,8 @@ pub enum TelemetryLevel {
}

impl Telemetry {
pub fn new(
command: &str,
start_time: Instant,
repository_path: Option<PathBuf>,
user_id: Option<String>,
) -> Self {
pub fn new(command: &str, start_time: Instant, repository_path: Option<PathBuf>) -> Self {
Telemetry {
user_id,
command: command.to_owned(),
start_time,
repository_path: repository_path.clone(),
Expand Down Expand Up @@ -136,7 +129,7 @@ impl Telemetry {
let message_id = Uuid::new_v4().to_string();

let track = Track {
user: segment_user(self.user_id.clone(), anonymous_id()?),
user: segment_user(None, anonymous_id()?),
event: event.to_owned(),
properties,
context: Some(segment_context()),
Expand All @@ -145,7 +138,7 @@ impl Telemetry {
.iter()
.cloned()
.collect(),
..Default::default()
integrations: None,
};

let batch = Batch {
Expand Down
10 changes: 1 addition & 9 deletions qlty-cli/src/telemetry/segment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,7 @@ pub enum User {
},
}

impl Default for User {
fn default() -> Self {
User::AnonymousId {
anonymous_id: "".to_owned(),
}
}
}

#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize, Default)]
#[derive(PartialEq, Eq, Debug, Clone, Serialize, Deserialize)]
pub struct Track {
/// The user associated with this message.
#[serde(flatten)]
Expand Down
3 changes: 0 additions & 3 deletions qlty-config/src/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ use crate::Library;
pub struct UserData {
pub version: String,

pub anonymous_id: String,

pub openai_api_key: Option<String>,

#[serde_as(as = "TimestampSeconds<i64>")]
Expand All @@ -22,7 +20,6 @@ impl Default for UserData {
fn default() -> Self {
Self {
version: "0".to_string(),
anonymous_id: uuid::Uuid::new_v4().to_string(),
openai_api_key: None,
version_checked_at: SystemTime::UNIX_EPOCH,
}
Expand Down

0 comments on commit 3b4773e

Please sign in to comment.