@@ -564,170 +564,10 @@ fn for_snowflake(
country_code: Option<String>,
checksum_matched: bool,
) -> impl Iterator<Item = SnowflakeRow> {
- body.events.into_iter().filter_map(move |event| {
+ body.events.into_iter().map(move |event| {
let timestamp =
first_event_at + Duration::milliseconds(event.milliseconds_since_first_event);
- // We will need to double check, but I believe all of the events that
- // are being transformed here are now migrated over to use the
- // telemetry::event! macro, as of this commit so this code can go away
- // when we feel enough users have upgraded past this point.
let (event_type, mut event_properties) = match &event.event {
- Event::Editor(e) => (
- match e.operation.as_str() {
- "open" => "Editor Opened".to_string(),
- "save" => "Editor Saved".to_string(),
- _ => format!("Unknown Editor Event: {}", e.operation),
- },
- serde_json::to_value(e).unwrap(),
- ),
- Event::EditPrediction(e) => (
- format!(
- "Edit Prediction {}",
- if e.suggestion_accepted {
- "Accepted"
- } else {
- "Discarded"
- }
- ),
- serde_json::to_value(e).unwrap(),
- ),
- Event::EditPredictionRating(e) => (
- "Edit Prediction Rated".to_string(),
- serde_json::to_value(e).unwrap(),
- ),
- Event::Call(e) => {
- let event_type = match e.operation.trim() {
- "unshare project" => "Project Unshared".to_string(),
- "open channel notes" => "Channel Notes Opened".to_string(),
- "share project" => "Project Shared".to_string(),
- "join channel" => "Channel Joined".to_string(),
- "hang up" => "Call Ended".to_string(),
- "accept incoming" => "Incoming Call Accepted".to_string(),
- "invite" => "Participant Invited".to_string(),
- "disable microphone" => "Microphone Disabled".to_string(),
- "enable microphone" => "Microphone Enabled".to_string(),
- "enable screen share" => "Screen Share Enabled".to_string(),
- "disable screen share" => "Screen Share Disabled".to_string(),
- "decline incoming" => "Incoming Call Declined".to_string(),
- _ => format!("Unknown Call Event: {}", e.operation),
- };
-
- (event_type, serde_json::to_value(e).unwrap())
- }
- Event::Assistant(e) => (
- match e.phase {
- telemetry_events::AssistantPhase::Response => "Assistant Responded".to_string(),
- telemetry_events::AssistantPhase::Invoked => "Assistant Invoked".to_string(),
- telemetry_events::AssistantPhase::Accepted => {
- "Assistant Response Accepted".to_string()
- }
- telemetry_events::AssistantPhase::Rejected => {
- "Assistant Response Rejected".to_string()
- }
- },
- serde_json::to_value(e).unwrap(),
- ),
- Event::Cpu(_) | Event::Memory(_) => return None,
- Event::App(e) => {
- let mut properties = json!({});
- let event_type = match e.operation.trim() {
- // App
- "open" => "App Opened".to_string(),
- "first open" => "App First Opened".to_string(),
- "first open for release channel" => {
- "App First Opened For Release Channel".to_string()
- }
- "close" => "App Closed".to_string(),
-
- // Project
- "open project" => "Project Opened".to_string(),
- "open node project" => {
- properties["project_type"] = json!("node");
- "Project Opened".to_string()
- }
- "open pnpm project" => {
- properties["project_type"] = json!("pnpm");
- "Project Opened".to_string()
- }
- "open yarn project" => {
- properties["project_type"] = json!("yarn");
- "Project Opened".to_string()
- }
-
- // SSH
- "create ssh server" => "SSH Server Created".to_string(),
- "create ssh project" => "SSH Project Created".to_string(),
- "open ssh project" => "SSH Project Opened".to_string(),
-
- // Welcome Page
- "welcome page: change keymap" => "Welcome Keymap Changed".to_string(),
- "welcome page: change theme" => "Welcome Theme Changed".to_string(),
- "welcome page: close" => "Welcome Page Closed".to_string(),
- "welcome page: edit settings" => "Welcome Settings Edited".to_string(),
- "welcome page: install cli" => "Welcome CLI Installed".to_string(),
- "welcome page: open" => "Welcome Page Opened".to_string(),
- "welcome page: open extensions" => "Welcome Extensions Page Opened".to_string(),
- "welcome page: sign in to copilot" => "Welcome Copilot Signed In".to_string(),
- "welcome page: toggle diagnostic telemetry" => {
- "Welcome Diagnostic Telemetry Toggled".to_string()
- }
- "welcome page: toggle metric telemetry" => {
- "Welcome Metric Telemetry Toggled".to_string()
- }
- "welcome page: toggle vim" => "Welcome Vim Mode Toggled".to_string(),
- "welcome page: view docs" => "Welcome Documentation Viewed".to_string(),
-
- // Extensions
- "extensions page: open" => "Extensions Page Opened".to_string(),
- "extensions: install extension" => "Extension Installed".to_string(),
- "extensions: uninstall extension" => "Extension Uninstalled".to_string(),
-
- // Misc
- "markdown preview: open" => "Markdown Preview Opened".to_string(),
- "project diagnostics: open" => "Project Diagnostics Opened".to_string(),
- "project search: open" => "Project Search Opened".to_string(),
- "repl sessions: open" => "REPL Session Started".to_string(),
-
- // Feature Upsell
- "feature upsell: toggle vim" => {
- properties["source"] = json!("Feature Upsell");
- "Vim Mode Toggled".to_string()
- }
- _ => e
- .operation
- .strip_prefix("feature upsell: viewed docs (")
- .and_then(|s| s.strip_suffix(')'))
- .map_or_else(
- || format!("Unknown App Event: {}", e.operation),
- |docs_url| {
- properties["url"] = json!(docs_url);
- properties["source"] = json!("Feature Upsell");
- "Documentation Viewed".to_string()
- },
- ),
- };
- (event_type, properties)
- }
- Event::Setting(e) => (
- "Settings Changed".to_string(),
- serde_json::to_value(e).unwrap(),
- ),
- Event::Extension(e) => (
- "Extension Loaded".to_string(),
- serde_json::to_value(e).unwrap(),
- ),
- Event::Edit(e) => (
- "Editor Edited".to_string(),
- serde_json::to_value(e).unwrap(),
- ),
- Event::Action(e) => (
- "Action Invoked".to_string(),
- serde_json::to_value(e).unwrap(),
- ),
- Event::Repl(e) => (
- "Kernel Status Changed".to_string(),
- serde_json::to_value(e).unwrap(),
- ),
Event::Flexible(e) => (
e.event_type.clone(),
serde_json::to_value(&e.event_properties).unwrap(),
@@ -759,7 +599,7 @@ fn for_snowflake(
})
});
- Some(SnowflakeRow {
+ SnowflakeRow {
time: timestamp,
user_id: body.metrics_id.clone(),
device_id: body.system_id.clone(),
@@ -767,7 +607,7 @@ fn for_snowflake(
event_properties,
user_properties,
insert_id: Some(Uuid::new_v4().to_string()),
- })
+ }
})
}
@@ -2,7 +2,7 @@
use semantic_version::SemanticVersion;
use serde::{Deserialize, Serialize};
-use std::{collections::HashMap, fmt::Display, sync::Arc, time::Duration};
+use std::{collections::HashMap, fmt::Display, time::Duration};
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct EventRequestBody {
@@ -93,19 +93,6 @@ impl Display for AssistantPhase {
#[serde(tag = "type")]
pub enum Event {
Flexible(FlexibleEvent),
- Editor(EditorEvent),
- EditPrediction(EditPredictionEvent),
- EditPredictionRating(EditPredictionRatingEvent),
- Call(CallEvent),
- Assistant(AssistantEventData),
- Cpu(CpuEvent),
- Memory(MemoryEvent),
- App(AppEvent),
- Setting(SettingEvent),
- Extension(ExtensionEvent),
- Edit(EditEvent),
- Action(ActionEvent),
- Repl(ReplEvent),
}
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
@@ -114,54 +101,12 @@ pub struct FlexibleEvent {
pub event_properties: HashMap<String, serde_json::Value>,
}
-#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
-pub struct EditorEvent {
- /// The editor operation performed (open, save)
- pub operation: String,
- /// The extension of the file that was opened or saved
- pub file_extension: Option<String>,
- /// Whether the user is in vim mode or not
- pub vim_mode: bool,
- /// Whether the user has copilot enabled or not
- pub copilot_enabled: bool,
- /// Whether the user has copilot enabled for the language of the file opened or saved
- pub copilot_enabled_for_language: bool,
- /// Whether the client is opening/saving a local file or a remote file via SSH
- #[serde(default)]
- pub is_via_ssh: bool,
-}
-
-#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
-pub struct EditPredictionEvent {
- /// Provider of the completion suggestion (e.g. copilot, supermaven)
- pub provider: String,
- pub suggestion_accepted: bool,
- pub file_extension: Option<String>,
-}
-
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub enum EditPredictionRating {
Positive,
Negative,
}
-#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
-pub struct EditPredictionRatingEvent {
- pub rating: EditPredictionRating,
- pub input_events: Arc<str>,
- pub input_excerpt: Arc<str>,
- pub output_excerpt: Arc<str>,
- pub feedback: String,
-}
-
-#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
-pub struct CallEvent {
- /// Operation performed: invite/join call; begin/end screenshare; share/unshare project; etc
- pub operation: String,
- pub room_id: Option<u64>,
- pub channel_id: Option<u64>,
-}
-
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct AssistantEventData {
/// Unique random identifier for each assistant tab (None for inline assist)
@@ -180,57 +125,6 @@ pub struct AssistantEventData {
pub language_name: Option<String>,
}
-#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
-pub struct CpuEvent {
- pub usage_as_percentage: f32,
- pub core_count: u32,
-}
-
-#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
-pub struct MemoryEvent {
- pub memory_in_bytes: u64,
- pub virtual_memory_in_bytes: u64,
-}
-
-#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
-pub struct ActionEvent {
- pub source: String,
- pub action: String,
-}
-
-#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
-pub struct EditEvent {
- pub duration: i64,
- pub environment: String,
- /// Whether the edits occurred locally or remotely via SSH
- #[serde(default)]
- pub is_via_ssh: bool,
-}
-
-#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
-pub struct SettingEvent {
- pub setting: String,
- pub value: String,
-}
-
-#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
-pub struct ExtensionEvent {
- pub extension_id: Arc<str>,
- pub version: Arc<str>,
-}
-
-#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
-pub struct AppEvent {
- pub operation: String,
-}
-
-#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
-pub struct ReplEvent {
- pub kernel_language: String,
- pub kernel_status: String,
- pub repl_session_id: String,
-}
-
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub struct BacktraceFrame {
pub ip: usize,