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

chore: add sentry tracing to backend

Louis Beaumont086d0434d2ef
diff --git a/Cargo.toml b/Cargo.toml
index 0c28756df..53cb0dd71 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -13,7 +13,7 @@ resolver = "2"
[workspace.package]
-version = "0.2.42"
+version = "0.2.43"
authors = ["louis030195 <[email protected]>"]
description = ""
repository = "https://github.com/mediar-ai/screenpipe"
@@ -43,7 +43,7 @@ vcpkg = "0.2"
cc = "1.0"
once_cell = "1.20.2"
-sentry = "0.36.0"
+sentry = { version = "0.36.0", features = ["tracing"] }
[patch.crates-io]
# enables chinese mirror (hf is banned in china) and native-tls
diff --git a/screenpipe-app-tauri/src-tauri/Cargo.toml b/screenpipe-app-tauri/src-tauri/Cargo.toml
index 5cdfaee94..beac568e6 100644
--- a/screenpipe-app-tauri/src-tauri/Cargo.toml
+++ b/screenpipe-app-tauri/src-tauri/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "screenpipe-app"
-version = "0.33.2"
+version = "0.33.3"
description = ""
authors = ["you"]
license = ""
diff --git a/screenpipe-server/src/bin/screenpipe-server.rs b/screenpipe-server/src/bin/screenpipe-server.rs
index 23cc0cb20..f19192ba5 100644
--- a/screenpipe-server/src/bin/screenpipe-server.rs
+++ b/screenpipe-server/src/bin/screenpipe-server.rs
@@ -90,8 +90,6 @@ fn setup_logging(local_data_dir: &PathBuf, cli: &Cli) -> anyhow::Result<WorkerGu
.add_directive("symphonia=error".parse().unwrap())
.add_directive("hf_hub=error".parse().unwrap());
- // filtering out xcap::platform::impl_window - Access is denied. (0x80070005)
- // which is noise
#[cfg(target_os = "windows")]
let env_filter = env_filter.add_directive("xcap::platform::impl_window=off".parse().unwrap());
@@ -119,23 +117,29 @@ fn setup_logging(local_data_dir: &PathBuf, cli: &Cli) -> anyhow::Result<WorkerGu
env_filter
};
- tracing_subscriber::registry()
+ let registry = tracing_subscriber::registry()
.with(env_filter)
.with(fmt::layer().with_writer(std::io::stdout))
- .with(fmt::layer().with_writer(non_blocking))
- .init();
+ .with(fmt::layer().with_writer(non_blocking));
+
+ // Build the final registry with conditional Sentry layer
+ if !cli.disable_telemetry {
+ registry.with(sentry::integrations::tracing::layer()).init();
+ } else {
+ registry.init();
+ };
Ok(guard)
}
#[tokio::main]
+#[tracing::instrument]
async fn main() -> anyhow::Result<()> {
debug!("starting screenpipe server");
let cli = Cli::parse();
// Initialize Sentry only if telemetry is enabled
let _sentry_guard = if !cli.disable_telemetry {
- // check if SENTRY_RELEASE_NAME_APPEND is set
let sentry_release_name_append = env::var("SENTRY_RELEASE_NAME_APPEND").unwrap_or_default();
let release_name = format!(
"{:?}{}",
@@ -506,7 +510,6 @@ async fn main() -> anyhow::Result<()> {
};
let audio_chunk_duration = Duration::from_secs(cli.audio_chunk_duration);
- let (realtime_transcription_sender, _) = tokio::sync::broadcast::channel(1000);
let (realtime_vision_sender, _) = tokio::sync::broadcast::channel(1000);
let realtime_vision_sender = Arc::new(realtime_vision_sender.clone());
let realtime_vision_sender_clone = realtime_vision_sender.clone();
@@ -517,7 +520,6 @@ async fn main() -> anyhow::Result<()> {
let realtime_vision_sender_clone = realtime_vision_sender.clone();
let vad_engine_clone = vad_engine.clone(); // Clone it here for each iteration
let mut shutdown_rx = shutdown_tx_clone.subscribe();
- let realtime_transcription_sender_clone = realtime_transcription_sender.clone();
let recording_future = start_continuous_recording(
db_clone.clone(),
output_path_clone.clone(),
@@ -543,7 +545,6 @@ async fn main() -> anyhow::Result<()> {
cli.capture_unfocused_windows,
realtime_audio_devices.clone(),
cli.enable_realtime_audio_transcription,
- Arc::new(realtime_transcription_sender_clone), // Use the cloned sender
realtime_vision_sender_clone,
);
diff --git a/screenpipe-server/src/core.rs b/screenpipe-server/src/core.rs
index 3c3448210..c0fd04176 100644
--- a/screenpipe-server/src/core.rs
+++ b/screenpipe-server/src/core.rs
@@ -5,7 +5,6 @@ use anyhow::Result;
use dashmap::DashMap;
use futures::future::join_all;
use tracing::{debug, error, info, warn};
-use screenpipe_audio::realtime::RealtimeTranscriptionEvent;
use screenpipe_audio::vad_engine::VadSensitivity;
use screenpipe_audio::{
create_whisper_channel, record_and_transcribe, vad_engine::VadEngineEnum, AudioDevice,
@@ -50,7 +49,6 @@ pub async fn start_continuous_recording(
capture_unfocused_windows: bool,
realtime_audio_devices: Vec<Arc<AudioDevice>>,
realtime_audio_enabled: bool,
- realtime_transcription_sender: Arc<tokio::sync::broadcast::Sender<RealtimeTranscriptionEvent>>,
realtime_vision_sender: Arc<tokio::sync::broadcast::Sender<RealtimeVisionEvent>>,
) -> Result<()> {
debug!("Starting video recording for monitor {:?}", monitor_ids);
@@ -138,7 +136,6 @@ pub async fn start_continuous_recording(
realtime_audio_enabled,
realtime_audio_devices,
languages,
- realtime_transcription_sender,
deepgram_api_key,
)
.await
@@ -296,13 +293,11 @@ async fn record_audio(
realtime_audio_enabled: bool,
realtime_audio_devices: Vec<Arc<AudioDevice>>,
languages: Vec<Language>,
- realtime_transcription_sender: Arc<tokio::sync::broadcast::Sender<RealtimeTranscriptionEvent>>,
deepgram_api_key: Option<String>,
) -> Result<()> {
let mut handles: HashMap<String, JoinHandle<()>> = HashMap::new();
let mut previous_transcript = "".to_string();
let mut previous_transcript_id: Option<i64> = None;
- let realtime_transcription_sender_clone = realtime_transcription_sender.clone();
loop {
// Iterate over DashMap entries and process each device
for entry in audio_devices_control.iter() {
@@ -335,7 +330,6 @@ async fn record_audio(
let realtime_audio_devices_clone = realtime_audio_devices.clone();
let languages_clone = languages.clone();
- let realtime_transcription_sender_clone = realtime_transcription_sender_clone.clone();
let deepgram_api_key_clone = deepgram_api_key.clone();
let handle = tokio::spawn(async move {
let audio_device_clone = Arc::clone(&audio_device);