Back to Blog Home

Introducing Sentry for Rust

Armin Ronacher image

Armin Ronacher -

Introducing Sentry for Rust

As happy Rust users ourselves, it makes us even happier to be able to say that we now have a Sentry Rust SDK. This means you and your Fungiculture can now report panics, failures, and other types of incidents to Sentry.

Not only is the SDK new and fancy, it is also one of the first ones that follows our new API guidelines for Sentry SDKs, which makes it even newer and fancier than you might normally expect.

What’s supported? The SDK can catch panics, easily log failures, catch errors from error-chain, log messages, and much more. Support is provided not just for emitting error events but also for also easily recording breadcrumbs.

Errors will contain as much information as possible at event submission, so the most important step is to make sure to ship your debug information in the executable. Experimental support for server side symbolication is also provided if you upload debug symbols.

Rust exception in Sentry

A Rust exception shown in Sentry

How do you get started? Easy!

First add sentry to your Cargo.toml:

[dependencies]
sentry = "0.3"

After that, this is all you need to do to capture failures and panics:

extern crate sentry;
    
use sentry::integrations::panic::register_panic_handler;
use sentry::integrations::failure::capture_error;
    
fn main() {
     let _sentry = sentry::init("YOUR_DSN_HERE");
     register_panic_handler();
    
     if let Err(err) = your_potentially_failing_function() {
         println!("error: {}", err);
         capture_error(&err);
     }
}

Is there anything else to know?

Sure thing, a good place to start is with our API docs. And if you have questions or feedback, post in our forum or issue tracker, or shout out to our support engineers. They’re here to help. And also to code. But mostly to help.

Share

Share on Twitter
Share on Facebook
Share on HackerNews
Share on LinkedIn

Published

Sentry Sign Up CTA

Code breaks, fix it faster

Sign up for Sentry and monitor your application in minutes.

Try Sentry Free

Topics

SDK Updates

The best way to debug slow web pages

Listen to the Syntax Podcast

Of course we sponsor a developer podcast. Check it out on your favorite listening platform.

Listen To Syntax
    TwitterGitHubDribbbleLinkedinDiscord
© 2024 • Sentry is a registered Trademark
of Functional Software, Inc.