mirror of
https://github.com/cloudflare/pingora.git
synced 2024-09-19 18:21:34 +02:00
fixup sentry unwrap
Don't unconditionally unwrap Sentry, guard it with a default value.
This commit is contained in:
parent
fd752da09f
commit
c9d75714e5
3 changed files with 9 additions and 12 deletions
2
.bleep
2
.bleep
|
@ -1 +1 @@
|
|||
46345c2f7b66cf4460de73ca2e62c819ab588735
|
||||
d2eaddcd278a00f25792bf06f046b39aa321abe3
|
|
@ -4,7 +4,12 @@ Any panic that happens to particular requests does not affect other ongoing requ
|
|||
|
||||
In order to monitor the panics, Pingora server has built-in Sentry integration.
|
||||
```rust
|
||||
my_server.sentry = Some("SENTRY_DSN");
|
||||
my_server.sentry = Some(
|
||||
sentry::ClientOptions{
|
||||
dsn: "SENTRY_DSN".into_dsn().unwrap(),
|
||||
..Default::default()
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
Even though a panic is not fatal in Pingora, it is still not the preferred way to handle failures like network timeouts. Panics should be reserved for unexpected logic errors.
|
||||
|
|
|
@ -257,11 +257,7 @@ impl Server {
|
|||
|
||||
/* only init sentry in release builds */
|
||||
#[cfg(not(debug_assertions))]
|
||||
let _guard = self
|
||||
.sentry
|
||||
.as_ref()
|
||||
.map(|opts| sentry::init(opts.clone()))
|
||||
.expect("sentry ClientOptions are valid");
|
||||
let _guard = self.sentry.as_ref().map(|opts| sentry::init(opts.clone()));
|
||||
|
||||
if self.options.as_ref().map_or(false, |o| o.test) {
|
||||
info!("Server Test passed, exiting");
|
||||
|
@ -305,11 +301,7 @@ impl Server {
|
|||
|
||||
/* only init sentry in release builds */
|
||||
#[cfg(not(debug_assertions))]
|
||||
let _guard = self
|
||||
.sentry
|
||||
.as_ref()
|
||||
.map(|opts| sentry::init(opts.clone()))
|
||||
.expect("sentry ClientOptions are valid");
|
||||
let _guard = self.sentry.as_ref().map(|opts| sentry::init(opts.clone()));
|
||||
|
||||
let mut runtimes: Vec<Runtime> = Vec::new();
|
||||
|
||||
|
|
Loading…
Reference in a new issue