An experimental Tauri Plugin for Sentry.
Captures and reports to Sentry:
- JavaScript errors and breadcrumbs in Tauri windows using
@sentry/browser - Panics and breadcrumbs in Rust via the Sentry Rust SDK
- Native crashes as minidumps
Add the plugin as a dependency in Cargo.toml:
[dependencies]
sentry = "0.27"
sentry-tauri = "0.1"Next, initialize the Rust half of the plugin:
fn main() {
let sentry_options = sentry::ClientOptions {
dsn:
"__YOUR_DSN__"
.into_dsn()
.expect("failed to parse DSN"),
release: sentry::release_name!(),
..Default::default()
};
tauri_plugin_sentry::init(
|_| sentry::init(init_opts),
move |sentry_plugin| {
tauri::Builder::default()
.plugin(sentry_plugin)
.run(tauri::generate_context!())
.expect("error while running tauri application");
},
);
}Then you can import and initialize the JavaScript half:
import * as Sentry from "tauri-plugin-sentry-api";
Sentry.init();The Tauri Sentry integration supports all options that the regulat @sentry/browser SDK does, so you can configure it like you're used to:
import { BrowserTracing } from "@sentry/tracing";
import * as Sentry from "tauri-plugin-sentry-api";
Sentry.init({
integrations: [new BrowserTracing()],
// Set tracesSampleRate to 1.0 to capture 100%
// of transactions for performance monitoring.
// We recommend adjusting this value in production
tracesSampleRate: 1.0,
});- Includes a
TauriIntegrationthat intercepts events and breadcrumbs and passes them to Rust via the TauriinvokeAPI - Tauri +
serde+ existing Sentry Rust types = Deserialisation mostly Just Works™️ - Uses
sentry-rust-minidumpwhich in turn uses theminidumperandcrash-handlercrates to capture minidumps in pure Rust and sends them as attachments using the Sentry Rust SDK
- There is currently no breadcrumb and scope synchronisation to the crash reporting process so these are missing from minidump events
Clone this repository and install dependencies:
> cd examples/basic-app
> yarn installIn examples/basic-app/src-tauri/src/main.rs replace __YOUR_DSN__ with your DSN
Run in development mode:
> yarn tauri dev