@@ -9,119 +9,119 @@ description: "Learn more about how the SDK can be configured via options. These
99``` go
1010// ClientOptions that configures a SDK Client
1111type ClientOptions struct {
12- // The DSN to use. If the DSN is not set, the client is effectively
13- // disabled.
14- Dsn string
15- // In debug mode, the debug information is printed to stdout to help you
16- // understand what Sentry is doing.
17- Debug bool
18- // Configures whether SDK should generate and attach stack traces to pure
19- // capture message calls.
20- AttachStacktrace bool
21- // The sample rate for event submission in the range [0.0, 1.0]. By default,
22- // all events are sent. Thus, as a historical special case, the sample rate
23- // 0.0 is treated as if it was 1.0. To drop all events, set the DSN to the
12+ // The DSN to use. If the DSN is not set, the client is effectively
13+ // disabled.
14+ Dsn string
15+ // In debug mode, the debug information is printed to stdout to help you
16+ // understand what Sentry is doing.
17+ Debug bool
18+ // Configures whether SDK should generate and attach stack traces to pure
19+ // capture message calls.
20+ AttachStacktrace bool
21+ // The sample rate for event submission in the range [0.0, 1.0]. By default,
22+ // all events are sent. Thus, as a historical special case, the sample rate
23+ // 0.0 is treated as if it was 1.0. To drop all events, set the DSN to the
2424 // empty string.
25- SampleRate float64
26- // Enable structured logging.
27- EnableLogs bool
28- // Enable performance tracing.
29- EnableTracing bool
30- // The sample rate for sampling traces in the range [0.0, 1.0].
31- TracesSampleRate float64
32- // Used to customize the sampling of traces, overrides TracesSampleRate.
33- TracesSampler TracesSampler
34- // The sample rate for profiling traces in the range [0.0, 1.0].
35- // This is relative to TracesSampleRate - it is a ratio of profiled traces out of all sampled traces.
36- ProfilesSampleRate float64
37- // List of regexp strings that will be used to match against event's message
38- // and if applicable, caught errors type and value.
39- // If the match is found, then a whole event will be dropped.
40- IgnoreErrors []string
41- // List of regexp strings that will be used to match against a transaction's
42- // name. If a match is found, then the transaction will be dropped.
43- IgnoreTransactions []string
44- // If this flag is enabled, certain personally identifiable information (PII) is added by active integrations.
45- // By default, no such data is sent.
46- SendDefaultPII bool
47- // BeforeSend is called before error events are sent to Sentry.
48- // Use it to mutate the event or return nil to discard the event.
49- BeforeSend func (event *Event, hint *EventHint) *Event
50- // BeforeSendTransaction is called before transaction events are sent to Sentry.
51- // Use it to mutate the transaction or return nil to discard the transaction.
52- BeforeSendTransaction func (event *Event, hint *EventHint) *Event
53- // Before breadcrumb add callback.
54- BeforeBreadcrumb func (breadcrumb *Breadcrumb, hint *BreadcrumbHint) *Breadcrumb
55- // Integrations to be installed on the current Client, receives default
56- // integrations.
57- Integrations func ([]Integration) []Integration
58- // io.Writer implementation that should be used with the Debug mode.
59- DebugWriter io.Writer
60- // The transport to use. Defaults to HTTPTransport.
61- Transport Transport
62- // The server name to be reported.
63- ServerName string
64- // The release to be sent with events.
65- //
66- // Some Sentry features are built around releases, and, thus, reporting
67- // events with a non-empty release improves the product experience. See
68- // https://docs.sentry.io/product/releases/.
69- //
70- // If Release is not set, the SDK will try to derive a default value
71- // from environment variables or the Git repository in the working
72- // directory.
73- //
74- // If you distribute a compiled binary, it is recommended to set the
75- // Release value explicitly at build time. As an example, you can use:
76- //
77- // go build -ldflags='-X main.release=VALUE'
78- //
79- // That will set the value of a predeclared variable 'release' in the
80- // 'main' package to 'VALUE'. Then, use that variable when initializing
81- // the SDK:
82- //
83- // sentry.Init(ClientOptions{Release: release})
84- //
85- // See https://golang.org/cmd/go/ and https://golang.org/cmd/link/ for
86- // the official documentation of -ldflags and -X, respectively.
87- Release string
88- // The dist to be sent with events.
89- Dist string
90- // The environment to be sent with events.
91- Environment string
92- // Maximum number of breadcrumbs
93- // when MaxBreadcrumbs is negative then ignore breadcrumbs.
94- MaxBreadcrumbs int
95- // Maximum number of spans.
96- //
97- // See https://develop.sentry.dev/sdk/data-model/envelopes/#size-limits for size limits
98- // applied during event ingestion. Events that exceed these limits might get dropped.
99- MaxSpans int
100- // An optional pointer to http.Client that will be used with a default
101- // HTTPTransport. Using your own client will make HTTPTransport, HTTPProxy,
102- // HTTPSProxy and CaCerts options ignored.
103- HTTPClient *http.Client
104- // An optional pointer to http.Transport that will be used with a default
105- // HTTPTransport. Using your own transport will make HTTPProxy, HTTPSProxy
106- // and CaCerts options ignored.
107- HTTPTransport http.RoundTripper
108- // An optional HTTP proxy to use.
109- // This will default to the HTTP_PROXY environment variable.
110- HTTPProxy string
111- // An optional HTTPS proxy to use.
112- // This will default to the HTTPS_PROXY environment variable.
113- // HTTPS_PROXY takes precedence over HTTP_PROXY for https requests.
114- HTTPSProxy string
115- // An optional set of SSL certificates to use.
116- CaCerts *x509.CertPool
117- // MaxErrorDepth is the maximum number of errors reported in a chain of errors.
118- // This protects the SDK from an arbitrarily long chain of wrapped errors.
119- //
120- // An additional consideration is that arguably reporting a long chain of errors
121- // is of little use when debugging production errors with Sentry. The Sentry UI
122- // is not optimized for long chains either. The top-level error together with a
123- // stack trace is often the most useful information.
124- MaxErrorDepth int
25+ SampleRate float64
26+ // Enable structured logging.
27+ EnableLogs bool
28+ // Enable performance tracing.
29+ EnableTracing bool
30+ // The sample rate for sampling traces in the range [0.0, 1.0].
31+ TracesSampleRate float64
32+ // Used to customize the sampling of traces, overrides TracesSampleRate.
33+ TracesSampler TracesSampler
34+ // The sample rate for profiling traces in the range [0.0, 1.0].
35+ // This is relative to TracesSampleRate - it is a ratio of profiled traces out of all sampled traces.
36+ ProfilesSampleRate float64
37+ // List of regexp strings that will be used to match against event's message
38+ // and if applicable, caught errors type and value.
39+ // If the match is found, then a whole event will be dropped.
40+ IgnoreErrors []string
41+ // List of regexp strings that will be used to match against a transaction's
42+ // name. If a match is found, then the transaction will be dropped.
43+ IgnoreTransactions []string
44+ // If this flag is enabled, certain personally identifiable information (PII) is added by active integrations.
45+ // By default, no such data is sent.
46+ SendDefaultPII bool
47+ // BeforeSend is called before error events are sent to Sentry.
48+ // Use it to mutate the event or return nil to discard the event.
49+ BeforeSend func (event *Event, hint *EventHint) *Event
50+ // BeforeSendTransaction is called before transaction events are sent to Sentry.
51+ // Use it to mutate the transaction or return nil to discard the transaction.
52+ BeforeSendTransaction func (event *Event, hint *EventHint) *Event
53+ // Before breadcrumb add callback.
54+ BeforeBreadcrumb func (breadcrumb *Breadcrumb, hint *BreadcrumbHint) *Breadcrumb
55+ // Integrations to be installed on the current Client, receives default
56+ // integrations.
57+ Integrations func ([]Integration) []Integration
58+ // io.Writer implementation that should be used with the Debug mode.
59+ DebugWriter io.Writer
60+ // The transport to use. Defaults to HTTPTransport.
61+ Transport Transport
62+ // The server name to be reported.
63+ ServerName string
64+ // The release to be sent with events.
65+ //
66+ // Some Sentry features are built around releases, and, thus, reporting
67+ // events with a non-empty release improves the product experience. See
68+ // https://docs.sentry.io/product/releases/.
69+ //
70+ // If Release is not set, the SDK will try to derive a default value
71+ // from environment variables or the Git repository in the working
72+ // directory.
73+ //
74+ // If you distribute a compiled binary, it is recommended to set the
75+ // Release value explicitly at build time. As an example, you can use:
76+ //
77+ // go build -ldflags='-X main.release=VALUE'
78+ //
79+ // That will set the value of a predeclared variable 'release' in the
80+ // 'main' package to 'VALUE'. Then, use that variable when initializing
81+ // the SDK:
82+ //
83+ // sentry.Init(ClientOptions{Release: release})
84+ //
85+ // See https://golang.org/cmd/go/ and https://golang.org/cmd/link/ for
86+ // the official documentation of -ldflags and -X, respectively.
87+ Release string
88+ // The dist to be sent with events.
89+ Dist string
90+ // The environment to be sent with events.
91+ Environment string
92+ // Maximum number of breadcrumbs
93+ // when MaxBreadcrumbs is negative then ignore breadcrumbs.
94+ MaxBreadcrumbs int
95+ // Maximum number of spans.
96+ //
97+ // See https://develop.sentry.dev/sdk/data-model/envelopes/#size-limits for size limits
98+ // applied during event ingestion. Events that exceed these limits might get dropped.
99+ MaxSpans int
100+ // An optional pointer to http.Client that will be used with a default
101+ // HTTPTransport. Using your own client will make HTTPTransport, HTTPProxy,
102+ // HTTPSProxy and CaCerts options ignored.
103+ HTTPClient *http.Client
104+ // An optional pointer to http.Transport that will be used with a default
105+ // HTTPTransport. Using your own transport will make HTTPProxy, HTTPSProxy
106+ // and CaCerts options ignored.
107+ HTTPTransport http.RoundTripper
108+ // An optional HTTP proxy to use.
109+ // This will default to the HTTP_PROXY environment variable.
110+ HTTPProxy string
111+ // An optional HTTPS proxy to use.
112+ // This will default to the HTTPS_PROXY environment variable.
113+ // HTTPS_PROXY takes precedence over HTTP_PROXY for https requests.
114+ HTTPSProxy string
115+ // An optional set of SSL certificates to use.
116+ CaCerts *x509.CertPool
117+ // MaxErrorDepth is the maximum number of errors reported in a chain of errors.
118+ // This protects the SDK from an arbitrarily long chain of wrapped errors.
119+ //
120+ // An additional consideration is that arguably reporting a long chain of errors
121+ // is of little use when debugging production errors with Sentry. The Sentry UI
122+ // is not optimized for long chains either. The top-level error together with a
123+ // stack trace is often the most useful information.
124+ MaxErrorDepth int
125125}
126126```
127127
0 commit comments