Add Sentry integration

This commit is contained in:
AppleTheGolden 2021-01-27 14:38:18 +01:00
parent bcf174cd1e
commit 951a33fae9
No known key found for this signature in database
GPG Key ID: F6AC8A62154C42AA
3 changed files with 675 additions and 328 deletions

987
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
name = "labrinth"
version = "0.1.0"
#Team members, please add your emails and usernames
authors = ["geometrically <jai.a@tuta.io>", "Redblueflame <contact@redblueflame.com>", "Aeledfyr <aeledfyr@gmail.com>", "Charalampos Fanoulis <yo@fanoulis.dev>"]
authors = ["geometrically <jai.a@tuta.io>", "Redblueflame <contact@redblueflame.com>", "Aeledfyr <aeledfyr@gmail.com>", "Charalampos Fanoulis <yo@fanoulis.dev>", "AppleTheGolden <scotsbox@protonmail.com>"]
edition = "2018"
[[bin]]
@ -44,4 +44,7 @@ futures-timer = "3.0.2"
rust-s3 = "0.26.1"
async-trait = "0.1.41"
sqlx = { version = "0.4.2", features = ["runtime-actix-rustls", "postgres", "chrono", "offline", "macros", "migrate"] }
sqlx = { version = "0.4.2", features = ["runtime-actix-rustls", "postgres", "chrono", "offline", "macros", "migrate"] }
sentry = { version = "0.22.0", features = ["log"] }
sentry-actix = "0.22.0"

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())