@@ -22,6 +22,7 @@ use daemon::daemonize;
22
22
use log:: { debug, error, info, warn} ;
23
23
use pingora_runtime:: Runtime ;
24
24
use pingora_timeout:: fast_timeout;
25
+ use sentry:: ClientOptions ;
25
26
use std:: sync:: Arc ;
26
27
use std:: thread;
27
28
use tokio:: signal:: unix;
@@ -62,14 +63,14 @@ pub struct Server {
62
63
shutdown_watch : watch:: Sender < bool > ,
63
64
// TODO: we many want to drop this copy to let sender call closed()
64
65
shutdown_recv : ShutdownWatch ,
65
- /// the parsed server configuration
66
+ /// The parsed server configuration
66
67
pub configuration : Arc < ServerConf > ,
67
- /// the parser command line options
68
+ /// The parser command line options
68
69
pub options : Option < Opt > ,
69
- /// the Sentry DSN
70
+ /// The Sentry ClientOptions.
70
71
///
71
- /// Panics and other events sentry captures will send to this DSN **only in release mode**
72
- pub sentry : Option < String > ,
72
+ /// Panics and other events sentry captures will be sent to this DSN **only in release mode**
73
+ pub sentry : Option < ClientOptions > ,
73
74
}
74
75
75
76
// TODO: delete the pid when exit
@@ -256,10 +257,11 @@ impl Server {
256
257
257
258
/* only init sentry in release builds */
258
259
#[ cfg( not( debug_assertions) ) ]
259
- let _guard = match self . sentry . as_ref ( ) {
260
- Some ( uri) => Some ( sentry:: init ( uri. as_str ( ) ) ) ,
261
- None => None ,
262
- } ;
260
+ let _guard = self
261
+ . sentry
262
+ . as_ref ( )
263
+ . map ( |opts| sentry:: init ( opts. clone ( ) ) )
264
+ . expect ( "sentry ClientOptions are valid" ) ;
263
265
264
266
if self . options . as_ref ( ) . map_or ( false , |o| o. test ) {
265
267
info ! ( "Server Test passed, exiting" ) ;
@@ -303,10 +305,11 @@ impl Server {
303
305
304
306
/* only init sentry in release builds */
305
307
#[ cfg( not( debug_assertions) ) ]
306
- let _guard = match self . sentry . as_ref ( ) {
307
- Some ( uri) => Some ( sentry:: init ( uri. as_str ( ) ) ) ,
308
- None => None ,
309
- } ;
308
+ let _guard = self
309
+ . sentry
310
+ . as_ref ( )
311
+ . map ( |opts| sentry:: init ( opts. clone ( ) ) )
312
+ . expect ( "sentry ClientOptions are valid" ) ;
310
313
311
314
let mut runtimes: Vec < Runtime > = Vec :: new ( ) ;
312
315
0 commit comments