Add Sentry integration

This commit is contained in:
AppleTheGolden
2021-01-27 14:38:18 +01:00
parent bcf174cd1e
commit 951a33fae9
3 changed files with 675 additions and 328 deletions

View File

@@ -86,6 +86,14 @@ async fn main() -> std::io::Result<()> {
info!("Skipping initial indexing");
}
// DSN is from SENTRY_DSN env variable.
// Has no effect if not set.
let sentry = sentry::init(());
if sentry.is_enabled() {
info!("Enabled Sentry integration");
std::env::set_var("RUST_BACKTRACE", "1");
}
database::check_for_migrations()
.await
.expect("An error occurred while running migrations.");
@@ -283,6 +291,7 @@ async fn main() -> std::io::Result<()> {
.with_interval(std::time::Duration::from_secs(60))
.with_max_requests(200),
)
.wrap(sentry_actix::Sentry::new())
.data(pool.clone())
.data(file_host.clone())
.data(indexing_queue.clone())