aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMatthew Gumport <[email protected]>2024-08-12 09:56:11 -0700
committerEdward Wang <[email protected]>2024-08-16 10:36:11 -0700
commit07a970e413009ee62fc4c15e0820ae1aa036af22 (patch)
tree08e613825dbc4c47257a3edb39c2267d6252fcfd
parentfba2c1df115fab18959c31978248c899444ef47d (diff)
downloadpingora-07a970e413009ee62fc4c15e0820ae1aa036af22.tar.gz
pingora-07a970e413009ee62fc4c15e0820ae1aa036af22.zip
add support for passing sentry release
This changes the Sentry field from the DSN string to the entire ClientOptions struct. This will let us pass more information to the client SDK, including the git-parsed version information.
-rw-r--r--.bleep2
-rw-r--r--pingora-core/src/server/mod.rs29
2 files changed, 17 insertions, 14 deletions
diff --git a/.bleep b/.bleep
index c40e0dc..85a7e4b 100644
--- a/.bleep
+++ b/.bleep
@@ -1 +1 @@
-bb9f706e0012bcb8d6734744c0fa8c4352969450 \ No newline at end of file
+46345c2f7b66cf4460de73ca2e62c819ab588735 \ No newline at end of file
diff --git a/pingora-core/src/server/mod.rs b/pingora-core/src/server/mod.rs
index 8ebf6fd..5fdecb2 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;
+use sentry::ClientOptions;
use std::sync::Arc;
use std::thread;
use tokio::signal::unix;
@@ -62,14 +63,14 @@ pub struct Server {
shutdown_watch: watch::Sender<bool>,
// TODO: we many want to drop this copy to let sender call closed()
shutdown_recv: ShutdownWatch,
- /// the parsed server configuration
+ /// The parsed server configuration
pub configuration: Arc<ServerConf>,
- /// the parser command line options
+ /// The parser command line options
pub options: Option<Opt>,
- /// the Sentry DSN
+ /// The Sentry ClientOptions.
///
- /// Panics and other events sentry captures will send to this DSN **only in release mode**
- pub sentry: Option<String>,
+ /// Panics and other events sentry captures will be sent to this DSN **only in release mode**
+ pub sentry: Option<ClientOptions>,
}
// TODO: delete the pid when exit
@@ -256,10 +257,11 @@ impl Server {
/* only init sentry in release builds */
#[cfg(not(debug_assertions))]
- let _guard = match self.sentry.as_ref() {
- Some(uri) => Some(sentry::init(uri.as_str())),
- None => None,
- };
+ let _guard = self
+ .sentry
+ .as_ref()
+ .map(|opts| sentry::init(opts.clone()))
+ .expect("sentry ClientOptions are valid");
if self.options.as_ref().map_or(false, |o| o.test) {
info!("Server Test passed, exiting");
@@ -303,10 +305,11 @@ impl Server {
/* only init sentry in release builds */
#[cfg(not(debug_assertions))]
- let _guard = match self.sentry.as_ref() {
- Some(uri) => Some(sentry::init(uri.as_str())),
- None => None,
- };
+ let _guard = self
+ .sentry
+ .as_ref()
+ .map(|opts| sentry::init(opts.clone()))
+ .expect("sentry ClientOptions are valid");
let mut runtimes: Vec<Runtime> = Vec::new();