-
Notifications
You must be signed in to change notification settings - Fork 1.1k
add minidump via sentry-tauri #1053
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
WalkthroughBumps workspace Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant App as Tauri App (main.rs)
participant FS as FileSystem
participant Tracing as tracing_appender
participant Sentry as sentry::init
participant Plugin as tauri_plugin_sentry::minidump::init
rect rgb(250,250,240)
note over App,FS: Logging setup
App->>FS: compute logs_dir & create dir
App->>Tracing: create daily rotating appender -> non_blocking writer + guard
Tracing-->>App: writer, guard
App->>App: register tracing layers (fmt with writer)
end
rect rgb(235,245,255)
note over App,Sentry: Sentry initialization
App->>Sentry: init(DSN, ClientOptions)
Sentry-->>App: sentry_client, guard
end
rect rgb(240,255,240)
note over App,Plugin: Minidump initialization (new)
App->>Plugin: init(&sentry_client)
Plugin-->>App: minidump_guard
end
App-->>App: retain sentry_client, sentry guards, and tracing guard for process lifetime
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 4
🧹 Nitpick comments (3)
apps/desktop/src-tauri/src/main.rs (3)
7-9: Remove unnecessary crate imports (will trip clippy).These bring crates into scope without using the
usebindings; you already refer to them fully qualified.Apply this diff:
-use dirs; -use tracing_appender;
56-70: Avoid unwrap() for log dirs; provide a safe fallback.
dirs::home_dir()anddata_local_dir()can be None. Use fallbacks to avoid panics.Apply this diff:
- let logs_dir = { - #[cfg(target_os = "macos")] - let path = dirs::home_dir() - .unwrap() - .join("Library/Logs") - .join("so.cap.desktop"); - - #[cfg(not(target_os = "macos"))] - let path = dirs::data_local_dir() - .unwrap() - .join("so.cap.desktop") - .join("logs"); - - path - }; + let logs_dir = { + #[cfg(target_os = "macos")] + { + dirs::home_dir() + .map(|p| p.join("Library/Logs").join("so.cap.desktop")) + .unwrap_or_else(|| std::env::temp_dir().join("so.cap.desktop")) + } + #[cfg(not(target_os = "macos"))] + { + dirs::data_local_dir() + .map(|p| p.join("so.cap.desktop").join("logs")) + .unwrap_or_else(|| std::env::temp_dir().join("so.cap.desktop").join("logs")) + } + };
77-81: Don’t mem::forget the non-blocking writer guard.Leaking the guard risks losing buffered logs. Keep it bound and let it drop at process end.
Apply this diff:
- let (non_blocking, _guard) = tracing_appender::non_blocking(file_appender); - // Keep the guard alive for the duration of the program - std::mem::forget(_guard); + let (non_blocking, _nb_guard) = tracing_appender::non_blocking(file_appender); + // Keep _nb_guard in scope; it will flush on Drop
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.github/workflows/publish.yml(1 hunks)apps/desktop/src-tauri/src/main.rs(4 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx,js,jsx,rs}
📄 CodeRabbit inference engine (CLAUDE.md)
Do not add inline, block, or docstring comments in any language; code must be self-explanatory
Files:
apps/desktop/src-tauri/src/main.rs
**/*.rs
📄 CodeRabbit inference engine (AGENTS.md)
**/*.rs: Format Rust code usingrustfmtand ensure all Rust code passes workspace-level clippy lints.
Rust modules should be named with snake_case, and crate directories should be in kebab-case.
Files:
apps/desktop/src-tauri/src/main.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Build Desktop (x86_64-pc-windows-msvc, windows-latest)
- GitHub Check: Build Desktop (aarch64-apple-darwin, macos-latest)
- GitHub Check: Analyze (rust)
🔇 Additional comments (1)
apps/desktop/src-tauri/src/main.rs (1)
46-50: Verified: minidump::init expects &sentry::ClientInitGuard — current call is correct.
tauri-plugin-sentry v0.5.0 (re-exporting sentry-rust-minidump) takes a &sentry::ClientInitGuard (the guard returned by sentry::init), not an Arc, so init(&sentry_client) is correct.
minidumpstarts a second process of the app to observe crashes, which are then reported to sentrySummary by CodeRabbit
New Features
Chores