Commit 2243a19 stefan.rieckhof
committed
1 parent 6b8db36 commit 2243a19 Copy full SHA for 2243a19
File tree 1 file changed +15
-2
lines changed
1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,10 @@ import (
15
15
)
16
16
17
17
func init () {
18
- var tracesSampleRate float64 = 0.1
18
+ var (
19
+ tracesSampleRate = 0.1
20
+ enableTracing = true
21
+ )
19
22
20
23
val := strings .TrimSpace (os .Getenv ("SENTRY_TRACES_SAMPLE_RATE" ))
21
24
if val != "" {
@@ -27,10 +30,20 @@ func init() {
27
30
}
28
31
}
29
32
33
+ valEnableTracing := strings .TrimSpace (os .Getenv ("SENTRY_ENABLE_TRACING" ))
34
+ if valEnableTracing != "" {
35
+ var err error
36
+
37
+ enableTracing , err = strconv .ParseBool (valEnableTracing )
38
+ if err != nil {
39
+ log .Fatalf ("failed to parse SENTRY_ENABLE_TRACING: %v" , err )
40
+ }
41
+ }
42
+
30
43
err := sentry .Init (sentry.ClientOptions {
31
44
Dsn : os .Getenv ("SENTRY_DSN" ),
32
45
Environment : os .Getenv ("ENVIRONMENT" ),
33
- EnableTracing : true ,
46
+ EnableTracing : enableTracing ,
34
47
TracesSampleRate : tracesSampleRate ,
35
48
BeforeSendTransaction : func (event * sentry.Event , hint * sentry.EventHint ) * sentry.Event {
36
49
// Drop request body.
You can’t perform that action at this time.
0 commit comments