File tree 2 files changed +17
-3
lines changed
2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -8,4 +8,5 @@ Property| Description
8
8
--- | ---
9
9
` SENTRY_DSN ` | The DSN to use.
10
10
` ENVIRONMENT ` | The environment to be sent with events.
11
- ` SENTRY_TRACES_SAMPLE_RATE ` | The tracing sample rate to use (default 0.1).
11
+ ` SENTRY_TRACES_SAMPLE_RATE ` | The tracing sample rate to use (default: 0.1).
12
+ ` SENTRY_ENABLE_TRACING ` | Enable or disable tracing (default: true).
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