Skip to content

YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context

fix(analytics): downgrade backend-unavailable health check errors to warn to suppress Sentry noise

Anshgrover232165978354c6
diff --git a/apps/screenpipe-app-tauri/src-tauri/src/analytics.rs b/apps/screenpipe-app-tauri/src-tauri/src/analytics.rs
index 266dee674..15c78c4c4 100755
--- a/apps/screenpipe-app-tauri/src-tauri/src/analytics.rs
+++ b/apps/screenpipe-app-tauri/src-tauri/src/analytics.rs
@@ -244,13 +244,23 @@ impl AnalyticsManager {
let health_status = match self.check_recording_health().await {
Ok(status) => status,
Err(e) => {
- error!("failed to check recording health: {}", e);
+ // Connection errors are expected when the backend hasn't started yet;
+ // downgrade to warn so Sentry doesn't treat startup races as errors.
+ let e_str = e.to_string();
+ if e_str.contains("error sending request")
+ || e_str.contains("Connection refused")
+ || e_str.contains("os error")
+ {
+ warn!("backend not yet available for health check: {}", e_str);
+ } else {
+ error!("failed to check recording health: {}", e_str);
+ }
json!({
"is_healthy": false,
"frame_status": "error",
"audio_status": "error",
"ui_status": "error",
- "error": e.to_string()
+ "error": e_str
})
}
};
@@ -339,7 +349,12 @@ impl AnalyticsManager {
&self,
) -> Result<serde_json::Value, Box<dyn std::error::Error>> {
let health_url = format!("{}/health", self.local_api_base_url);
- let response = self.client.get(&health_url).send().await?;
+ let response = self
+ .client
+ .get(&health_url)
+ .timeout(Duration::from_secs(5))
+ .send()
+ .await?;
if !response.status().is_success() {
return Ok(json!({