mirror of
https://github.com/cloudflare/pingora.git
synced 2024-09-20 02:31:35 +02:00
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.
This commit is contained in:
parent
5e6a2c6795
commit
fd752da09f
2 changed files with 17 additions and 14 deletions
2
.bleep
2
.bleep
|
@ -1 +1 @@
|
|||
bb9f706e0012bcb8d6734744c0fa8c4352969450
|
||||
46345c2f7b66cf4460de73ca2e62c819ab588735
|
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in a new issue