From ab1b717bf587723c1c537d6549a8f8096f0900d4 Mon Sep 17 00:00:00 2001 From: Kevin Guthrie Date: Fri, 4 Oct 2024 16:47:51 -0400 Subject: [PATCH] Make sentry an optional feature --- .bleep | 2 +- pingora-core/Cargo.toml | 9 ++++++--- pingora-core/src/server/mod.rs | 4 ++++ pingora-proxy/Cargo.toml | 5 +++-- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/.bleep b/.bleep index f8542c16..ccd79207 100644 --- a/.bleep +++ b/.bleep @@ -1 +1 @@ -5bbb21bd377e352872ab767af7583e4d8e9022f8 \ No newline at end of file +db1062544ff6061f40cf33801b12a8c407c0d574 \ No newline at end of file diff --git a/pingora-core/Cargo.toml b/pingora-core/Cargo.toml index 496e4015..3534aea9 100644 --- a/pingora-core/Cargo.toml +++ b/pingora-core/Cargo.toml @@ -51,7 +51,7 @@ sentry = { version = "0.26", features = [ "panic", "reqwest", "rustls", -], default-features = false } +], default-features = false, optional = true } regex = "1" percent-encoding = "2.1" parking_lot = { version = "0.12", features = ["arc_lock"] } @@ -77,7 +77,9 @@ windows-sys = { version = "0.59.0", features = ["Win32_Networking_WinSock"] } [dev-dependencies] matches = "0.1" env_logger = "0.9" -reqwest = { version = "0.11", features = ["rustls"], default-features = false } +reqwest = { version = "0.11", features = [ + "rustls-tls", +], default-features = false } hyper = "0.14" [target.'cfg(unix)'.dev-dependencies] @@ -88,5 +90,6 @@ jemallocator = "0.5" default = ["openssl"] openssl = ["pingora-openssl", "some_tls"] boringssl = ["pingora-boringssl", "some_tls"] +sentry = ["dep:sentry"] patched_http1 = [] -some_tls = [] \ No newline at end of file +some_tls = [] diff --git a/pingora-core/src/server/mod.rs b/pingora-core/src/server/mod.rs index d9e57ddc..0a2977dc 100644 --- a/pingora-core/src/server/mod.rs +++ b/pingora-core/src/server/mod.rs @@ -22,6 +22,7 @@ use daemon::daemonize; use log::{debug, error, info, warn}; use pingora_runtime::Runtime; use pingora_timeout::fast_timeout; +#[cfg(feature = "sentry")] use sentry::ClientOptions; use std::sync::Arc; use std::thread; @@ -67,6 +68,7 @@ pub struct Server { pub configuration: Arc, /// The parser command line options pub options: Option, + #[cfg(feature = "sentry")] /// The Sentry ClientOptions. /// /// Panics and other events sentry captures will be sent to this DSN **only in release mode** @@ -191,6 +193,7 @@ impl Server { shutdown_recv: rx, configuration: Arc::new(conf), options: Some(opt), + #[cfg(feature = "sentry")] sentry: None, } } @@ -231,6 +234,7 @@ impl Server { shutdown_recv: rx, configuration: Arc::new(conf), options: opt, + #[cfg(feature = "sentry")] sentry: None, }) } diff --git a/pingora-proxy/Cargo.toml b/pingora-proxy/Cargo.toml index b94711da..13d48048 100644 --- a/pingora-proxy/Cargo.toml +++ b/pingora-proxy/Cargo.toml @@ -37,7 +37,7 @@ regex = "1" [dev-dependencies] reqwest = { version = "0.11", features = [ "gzip", - "rustls", + "rustls-tls", ], default-features = false } tokio-test = "0.4" env_logger = "0.9" @@ -58,10 +58,11 @@ hyperlocal = "0.8" default = ["openssl"] openssl = ["pingora-core/openssl", "pingora-cache/openssl"] boringssl = ["pingora-core/boringssl", "pingora-cache/boringssl"] +sentry = ["pingora-core/sentry"] # or locally cargo doc --config "build.rustdocflags='--cfg doc_async_trait'" [package.metadata.docs.rs] rustdoc-args = ["--cfg", "doc_async_trait"] [lints.rust] -unexpected_cfgs = { level = "warn", check-cfg = ['cfg(doc_async_trait)'] } \ No newline at end of file +unexpected_cfgs = { level = "warn", check-cfg = ['cfg(doc_async_trait)'] }