diff options
author | Yuchen Wu <[email protected]> | 2024-09-27 09:24:16 -0700 |
---|---|---|
committer | Yuchen Wu <[email protected]> | 2024-10-11 15:40:59 -0700 |
commit | 232614246229ff23f483e666abc43b93178534a0 (patch) | |
tree | e4f9ebbc286abaf4caf761533ddc84fef1b5b6b6 | |
parent | 4aadba12727afe6178f3b9fc2a3cad2223ac7b2e (diff) | |
download | pingora-232614246229ff23f483e666abc43b93178534a0.tar.gz pingora-232614246229ff23f483e666abc43b93178534a0.zip |
feat(core): make 'sentry' optional
Co-authored-by: Grvzard <[email protected]>
-rw-r--r-- | .bleep | 2 | ||||
-rw-r--r-- | pingora-core/Cargo.toml | 2 | ||||
-rw-r--r-- | pingora-core/src/server/mod.rs | 9 |
3 files changed, 7 insertions, 6 deletions
@@ -1 +1 @@ -ca6a894f27f4448b3d0fe7ab3d84221133e83e5b
\ No newline at end of file +e2493b0330def4631d98161f1f0a477b440f3a85
\ No newline at end of file diff --git a/pingora-core/Cargo.toml b/pingora-core/Cargo.toml index 3534aea..5fa60ae 100644 --- a/pingora-core/Cargo.toml +++ b/pingora-core/Cargo.toml @@ -26,7 +26,7 @@ pingora-pool = { version = "0.3.0", path = "../pingora-pool" } pingora-error = { version = "0.3.0", path = "../pingora-error" } pingora-timeout = { version = "0.3.0", path = "../pingora-timeout" } pingora-http = { version = "0.3.0", path = "../pingora-http" } -tokio = { workspace = true, features = ["rt-multi-thread", "signal"] } +tokio = { workspace = true, features = ["net", "rt-multi-thread", "signal"] } futures = "0.3" async-trait = { workspace = true } httparse = { workspace = true } diff --git a/pingora-core/src/server/mod.rs b/pingora-core/src/server/mod.rs index d28b00c..c86c49e 100644 --- a/pingora-core/src/server/mod.rs +++ b/pingora-core/src/server/mod.rs @@ -76,6 +76,7 @@ pub struct Server { /// The parser command line options pub options: Option<Opt>, #[cfg(feature = "sentry")] + #[cfg_attr(docsrs, doc(cfg(feature = "sentry")))] /// The Sentry ClientOptions. /// /// Panics and other events sentry captures will be sent to this DSN **only in release mode** @@ -126,7 +127,7 @@ impl Server { Err(e) => { error!("Unable to send listener sockets to new process: {e}"); // sentry log error on fd send failure - #[cfg(not(debug_assertions))] + #[cfg(all(not(debug_assertions), feature = "sentry"))] sentry::capture_error(&e); } } @@ -276,7 +277,7 @@ impl Server { debug!("{:#?}", self.options); /* only init sentry in release builds */ - #[cfg(not(debug_assertions))] + #[cfg(all(not(debug_assertions), feature = "sentry"))] let _guard = self.sentry.as_ref().map(|opts| sentry::init(opts.clone())); if self.options.as_ref().map_or(false, |o| o.test) { @@ -292,7 +293,7 @@ impl Server { } Err(e) => { // sentry log error on fd load failure - #[cfg(not(debug_assertions))] + #[cfg(all(not(debug_assertions), feature = "sentry"))] sentry::capture_error(&e); error!("Bootstrap failed on error: {:?}, exiting.", e); @@ -327,7 +328,7 @@ impl Server { } /* only init sentry in release builds */ - #[cfg(not(debug_assertions))] + #[cfg(all(not(debug_assertions), feature = "sentry"))] let _guard = self.sentry.as_ref().map(|opts| sentry::init(opts.clone())); let mut runtimes: Vec<Runtime> = Vec::new(); |