File tree 1 file changed +5
-2
lines changed
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,8 @@ mod middleware;
2
2
3
3
use crate :: env_optional;
4
4
pub use middleware:: CustomSentryMiddleware as SentryMiddleware ;
5
- use sentry:: { ClientInitGuard , ClientOptions , IntoDsn } ;
5
+ use sentry:: { ClientInitGuard , ClientOptions , IntoDsn , TransactionContext } ;
6
+ use std:: sync:: Arc ;
6
7
7
8
/// Initializes the Sentry SDK from the environment variables.
8
9
///
@@ -28,13 +29,15 @@ pub fn init() -> ClientInitGuard {
28
29
29
30
let traces_sample_rate = env_optional ( "SENTRY_TRACES_SAMPLE_RATE" ) . unwrap_or ( 0.0 ) ;
30
31
32
+ let traces_sampler = move |_ctx : & TransactionContext | -> f32 { traces_sample_rate } ;
33
+
31
34
let opts = ClientOptions {
32
35
auto_session_tracking : true ,
33
36
dsn,
34
37
environment,
35
38
release,
36
39
session_mode : sentry:: SessionMode :: Request ,
37
- traces_sample_rate ,
40
+ traces_sampler : Some ( Arc :: new ( traces_sampler ) ) ,
38
41
..Default :: default ( )
39
42
} ;
40
43
You can’t perform that action at this time.
0 commit comments