Sentry Rust SDK: sentry-actix
This crate adds a middleware for actix-web
that captures errors and
report them to Sentry
.
To use this middleware just configure Sentry and then add it to your actix web app as a middleware. Because actix is generally working with non sendable objects and highly concurrent this middleware creates a new hub per request. As a result many of the sentry integrations such as breadcrumbs do not work unless you bind the actix hub.
Example
use env;
use io;
use ;
use SentryMiddleware;
Reusing the Hub
If you use this integration the Hub::current()
returned hub is typically the wrong one.
To get the request specific one you need to use the ActixWebHubExt
trait:
use ;
use ActixWebHubExt;
let hub = from_request;
hub.capture_message;
The hub can also be made current:
use ;
use ActixWebHubExt;
let hub = from_request;
run;
Resources
License: Apache-2.0
- Discord server for project discussions.
- Follow @getsentry on Twitter for updates