Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
feat(desktop): emit recovery telemetry through posthog
Richie McIlroy6e8f26e73204
diff --git a/apps/desktop/src-tauri/src/recovery.rs b/apps/desktop/src-tauri/src/recovery.rsindex 381a31ae2..b038e1694 100644--- a/apps/desktop/src-tauri/src/recovery.rs+++ b/apps/desktop/src-tauri/src/recovery.rs@@ -76,7 +76,7 @@ pub async fn find_incomplete_recordings(#[tauri::command]#[specta::specta]-pub async fn recover_recording(_app: AppHandle, project_path: String) -> Result<String, String> {+pub async fn recover_recording(app: AppHandle, project_path: String) -> Result<String, String> {let path = PathBuf::from(&project_path);let recording = tokio::task::spawn_blocking(move || RecoveryManager::inspect_recording(&path))@@ -88,7 +88,23 @@ pub async fn recover_recording(_app: AppHandle, project_path: String) -> Result<return Err("No recoverable segments found".to_string());}- let recovered = RecoveryManager::recover(&recording).map_err(|e| format!("{e}"))?;+ let estimated_duration_secs = recording.estimated_duration.as_secs();+ let recover_start = std::time::Instant::now();+ let recovered = match RecoveryManager::recover(&recording) {+ Ok(r) => r,+ Err(e) => {+ let reason = format!("{e}");+ crate::posthog::async_capture_event(+ &app,+ crate::posthog::PostHogEvent::RecordingRecoveryFailed {+ trigger: "app_startup",+ reason: reason.clone(),+ },+ );+ return Err(reason);+ }+ };+ let validation_took_ms = recover_start.elapsed().as_millis() as u64;let segment_count = match &recovered.meta {StudioRecordingMeta::SingleSegment { .. } => 1,@@ -100,6 +116,16 @@ pub async fn recover_recording(_app: AppHandle, project_path: String) -> Result<segment_count, project_path);+ crate::posthog::async_capture_event(+ &app,+ crate::posthog::PostHogEvent::RecordingRecovered {+ trigger: "app_startup",+ recovered_duration_secs: estimated_duration_secs,+ segments_recovered: segment_count as u32,+ validation_took_ms,+ },+ );+let display_output_path = match &recovered.meta {StudioRecordingMeta::SingleSegment { segment } => {segment.display.path.to_path(&recovered.project_path)