File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed
Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -8,4 +8,5 @@ Property| Description
88--- | ---
99` SENTRY_DSN ` | The DSN to use.
1010` 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 (
1515)
1616
1717func init () {
18- var tracesSampleRate float64 = 0.1
18+ var (
19+ tracesSampleRate = 0.1
20+ enableTracing = true
21+ )
1922
2023 val := strings .TrimSpace (os .Getenv ("SENTRY_TRACES_SAMPLE_RATE" ))
2124 if val != "" {
@@ -27,10 +30,20 @@ func init() {
2730 }
2831 }
2932
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+
3043 err := sentry .Init (sentry.ClientOptions {
3144 Dsn : os .Getenv ("SENTRY_DSN" ),
3245 Environment : os .Getenv ("ENVIRONMENT" ),
33- EnableTracing : true ,
46+ EnableTracing : enableTracing ,
3447 TracesSampleRate : tracesSampleRate ,
3548 BeforeSendTransaction : func (event * sentry.Event , hint * sentry.EventHint ) * sentry.Event {
3649 // Drop request body.
You can’t perform that action at this time.
0 commit comments