Add command palette action events

This commit is contained in:
Joseph T. Lyons 2024-01-15 20:22:47 -05:00
parent deac172e39
commit 268d156fad
4 changed files with 41 additions and 5 deletions

View file

@ -129,6 +129,11 @@ pub enum Event {
environment: &'static str,
milliseconds_since_first_event: i64,
},
Action {
source: &'static str,
action: String,
milliseconds_since_first_event: i64,
},
}
#[cfg(debug_assertions)]
@ -420,6 +425,16 @@ impl Telemetry {
}
}
pub fn report_action_event(self: &Arc<Self>, source: &'static str, action: String) {
let event = Event::Action {
source,
action,
milliseconds_since_first_event: self.milliseconds_since_first_event(),
};
self.report_event(event)
}
fn milliseconds_since_first_event(&self) -> i64 {
let mut state = self.state.lock();