194: Bump sentry version r=MarinPostma a=irevoire

closes #102 

Co-authored-by: tamo <tamo@meilisearch.com>
This commit is contained in:
bors[bot] 2021-06-14 08:34:04 +00:00 committed by GitHub
commit 1e659bb17b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 165 additions and 519 deletions

632
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -78,17 +78,15 @@ pin-project = "1.0.7"
[dependencies.sentry] [dependencies.sentry]
default-features = false default-features = false
features = [ features = [
"with_client_implementation", "backtrace",
"with_panic", "contexts",
"with_failure", "panic",
"with_device_info", "reqwest",
"with_rust_info", "rustls",
"with_reqwest_transport", "log",
"with_rustls",
"with_env_logger"
] ]
optional = true optional = true
version = "0.18.1" version = "0.22.0"
[dev-dependencies] [dev-dependencies]

View File

@ -15,18 +15,8 @@ static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
async fn main() -> Result<(), MainError> { async fn main() -> Result<(), MainError> {
let opt = Opt::from_args(); let opt = Opt::from_args();
#[cfg(all(not(debug_assertions), feature = "sentry"))] let mut log_builder =
let _sentry = sentry::init(( env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("info"));
if !opt.no_sentry {
Some(opt.sentry_dsn.clone())
} else {
None
},
sentry::ClientOptions {
release: sentry::release_name!(),
..Default::default()
},
));
match opt.env.as_ref() { match opt.env.as_ref() {
"production" => { "production" => {
@ -36,16 +26,26 @@ async fn main() -> Result<(), MainError> {
.into(), .into(),
); );
} }
#[cfg(all(not(debug_assertions), feature = "sentry"))] #[cfg(all(not(debug_assertions), feature = "sentry"))]
if !opt.no_sentry && _sentry.is_enabled() { if !opt.no_sentry {
sentry::integrations::panic::register_panic_handler(); // TODO: This shouldn't be needed when upgrading to sentry 0.19.0. These integrations are turned on by default when using `sentry::init`. let logger = sentry::integrations::log::SentryLogger::with_dest(log_builder.build());
sentry::integrations::env_logger::init(None, Default::default()); log::set_boxed_logger(Box::new(logger))
.map(|()| log::set_max_level(log::LevelFilter::Info))
.unwrap();
let sentry = sentry::init(sentry::ClientOptions {
release: sentry::release_name!(),
dsn: Some(opt.sentry_dsn.parse()?),
..Default::default()
});
// sentry must stay alive as long as possible
std::mem::forget(sentry);
} else {
log_builder.init();
} }
} }
"development" => { "development" => {
env_logger::Builder::from_env(env_logger::Env::default().default_filter_or("info")) log_builder.init();
.init();
} }
_ => unreachable!(), _ => unreachable!(),
} }