@@ -9,117 +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 performance tracing.
27- EnableTracing bool
28- // The sample rate for sampling traces in the range [0.0, 1.0].
29- TracesSampleRate float64
30- // Used to customize the sampling of traces, overrides TracesSampleRate.
31- TracesSampler TracesSampler
32- // The sample rate for profiling traces in the range [0.0, 1.0].
33- // This is relative to TracesSampleRate - it is a ratio of profiled traces out of all sampled traces.
34- ProfilesSampleRate float64
35- // List of regexp strings that will be used to match against event's message
36- // and if applicable, caught errors type and value.
37- // If the match is found, then a whole event will be dropped.
38- IgnoreErrors []string
39- // List of regexp strings that will be used to match against a transaction's
40- // name. If a match is found, then the transaction will be dropped.
41- IgnoreTransactions []string
42- // If this flag is enabled, certain personally identifiable information (PII) is added by active integrations.
43- // By default, no such data is sent.
44- SendDefaultPII bool
45- // BeforeSend is called before error events are sent to Sentry.
46- // Use it to mutate the event or return nil to discard the event.
47- BeforeSend func (event *Event, hint *EventHint) *Event
48- // BeforeSendTransaction is called before transaction events are sent to Sentry.
49- // Use it to mutate the transaction or return nil to discard the transaction.
50- BeforeSendTransaction func (event *Event, hint *EventHint) *Event
51- // Before breadcrumb add callback.
52- BeforeBreadcrumb func (breadcrumb *Breadcrumb, hint *BreadcrumbHint) *Breadcrumb
53- // Integrations to be installed on the current Client, receives default
54- // integrations.
55- Integrations func ([]Integration) []Integration
56- // io.Writer implementation that should be used with the Debug mode.
57- DebugWriter io.Writer
58- // The transport to use. Defaults to HTTPTransport.
59- Transport Transport
60- // The server name to be reported.
61- ServerName string
62- // The release to be sent with events.
63- //
64- // Some Sentry features are built around releases, and, thus, reporting
65- // events with a non-empty release improves the product experience. See
66- // https://docs.sentry.io/product/releases/.
67- //
68- // If Release is not set, the SDK will try to derive a default value
69- // from environment variables or the Git repository in the working
70- // directory.
71- //
72- // If you distribute a compiled binary, it is recommended to set the
73- // Release value explicitly at build time. As an example, you can use:
74- //
75- // go build -ldflags='-X main.release=VALUE'
76- //
77- // That will set the value of a predeclared variable 'release' in the
78- // 'main' package to 'VALUE'. Then, use that variable when initializing
79- // the SDK:
80- //
81- // sentry.Init(ClientOptions{Release: release})
82- //
83- // See https://golang.org/cmd/go/ and https://golang.org/cmd/link/ for
84- // the official documentation of -ldflags and -X, respectively.
85- Release string
86- // The dist to be sent with events.
87- Dist string
88- // The environment to be sent with events.
89- Environment string
90- // Maximum number of breadcrumbs
91- // when MaxBreadcrumbs is negative then ignore breadcrumbs.
92- MaxBreadcrumbs int
93- // Maximum number of spans.
94- //
95- // See https://develop.sentry.dev/sdk/data-model/envelopes/#size-limits for size limits
96- // applied during event ingestion. Events that exceed these limits might get dropped.
97- MaxSpans int
98- // An optional pointer to http.Client that will be used with a default
99- // HTTPTransport. Using your own client will make HTTPTransport, HTTPProxy,
100- // HTTPSProxy and CaCerts options ignored.
101- HTTPClient *http.Client
102- // An optional pointer to http.Transport that will be used with a default
103- // HTTPTransport. Using your own transport will make HTTPProxy, HTTPSProxy
104- // and CaCerts options ignored.
105- HTTPTransport http.RoundTripper
106- // An optional HTTP proxy to use.
107- // This will default to the HTTP_PROXY environment variable.
108- HTTPProxy string
109- // An optional HTTPS proxy to use.
110- // This will default to the HTTPS_PROXY environment variable.
111- // HTTPS_PROXY takes precedence over HTTP_PROXY for https requests.
112- HTTPSProxy string
113- // An optional set of SSL certificates to use.
114- CaCerts *x509.CertPool
115- // MaxErrorDepth is the maximum number of errors reported in a chain of errors.
116- // This protects the SDK from an arbitrarily long chain of wrapped errors.
117- //
118- // An additional consideration is that arguably reporting a long chain of errors
119- // is of little use when debugging production errors with Sentry. The Sentry UI
120- // is not optimized for long chains either. The top-level error together with a
121- // stack trace is often the most useful information.
122- 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
123125}
124126```
125127
@@ -129,15 +131,6 @@ By default, TLS uses the host's root CA set. If you don't have `ca-certificates`
129131
130132
131133``` go
132- package main
133-
134- import (
135- " log"
136-
137- " github.com/certifi/gocertifi"
138- " github.com/getsentry/sentry-go"
139- )
140-
141134sentryClientOptions := sentry.ClientOptions {
142135 Dsn : " ___PUBLIC_DSN___" ,
143136}
0 commit comments