From 92ab7aacc3790988f95ae08636b09279668aa2aa Mon Sep 17 00:00:00 2001 From: Giannis Gkiortzis Date: Fri, 3 Oct 2025 12:15:12 +0200 Subject: [PATCH 1/4] feat(go): refactor options page --- .../go/common/configuration/options.mdx | 348 ++++++++++++------ .../configuration/config-intro/go.mdx | 9 +- 2 files changed, 239 insertions(+), 118 deletions(-) diff --git a/docs/platforms/go/common/configuration/options.mdx b/docs/platforms/go/common/configuration/options.mdx index 131603460e6252..8bd4e93577e11c 100644 --- a/docs/platforms/go/common/configuration/options.mdx +++ b/docs/platforms/go/common/configuration/options.mdx @@ -6,125 +6,241 @@ description: "Learn more about how the SDK can be configured via options. These +## Core Options + +Options that can be read from an environment variable (`SENTRY_DSN`, `SENTRY_ENVIRONMENT`, `SENTRY_RELEASE`) are read automatically. + + + +The DSN tells the SDK where to send the events. If this value is not provided, the SDK will try to read it from the `SENTRY_DSN` environment variable. If that variable also does not exist, the SDK will just not send any events. + +Learn more about [DSN utilization](/product/sentry-basics/dsn-explainer/#dsn-utilization). + + + + + +If debug is enabled, the SDK will attempt to print out useful debugging information if something goes wrong while sending the event. The default is always `false`. It's generally not recommended to turn it on in production, though turning `debug` mode on will not cause any safety concerns. + + + + + +Sets the release. Some Sentry features are built around releases, and, thus, reporting events with a non-empty release improves the product experience. See [the releases documentation](/product/releases/). + +If Release is not set, the SDK will try to derive a default value from environment variables or the Git repository in the working directory. + +If you distribute a compiled binary, it is recommended to set the Release value explicitly at build time. As an example, you can use: + ```go -// ClientOptions that configures a SDK Client -type ClientOptions struct { - // The DSN to use. If the DSN is not set, the client is effectively - // disabled. - Dsn string - // In debug mode, the debug information is printed to stdout to help you - // understand what Sentry is doing. - Debug bool - // Configures whether SDK should generate and attach stack traces to pure - // capture message calls. - AttachStacktrace bool - // The sample rate for event submission in the range [0.0, 1.0]. By default, - // all events are sent. Thus, as a historical special case, the sample rate - // 0.0 is treated as if it was 1.0. To drop all events, set the DSN to the - // empty string. - SampleRate float64 - // Enable structured logging. - EnableLogs bool - // Enable performance tracing. - EnableTracing bool - // The sample rate for sampling traces in the range [0.0, 1.0]. - TracesSampleRate float64 - // Used to customize the sampling of traces, overrides TracesSampleRate. - TracesSampler TracesSampler - // The sample rate for profiling traces in the range [0.0, 1.0]. - // This is relative to TracesSampleRate - it is a ratio of profiled traces out of all sampled traces. - ProfilesSampleRate float64 - // List of regexp strings that will be used to match against event's message - // and if applicable, caught errors type and value. - // If the match is found, then a whole event will be dropped. - IgnoreErrors []string - // List of regexp strings that will be used to match against a transaction's - // name. If a match is found, then the transaction will be dropped. - IgnoreTransactions []string - // If this flag is enabled, certain personally identifiable information (PII) is added by active integrations. - // By default, no such data is sent. - SendDefaultPII bool - // BeforeSend is called before error events are sent to Sentry. - // Use it to mutate the event or return nil to discard the event. - BeforeSend func(event *Event, hint *EventHint) *Event - // BeforeSendTransaction is called before transaction events are sent to Sentry. - // Use it to mutate the transaction or return nil to discard the transaction. - BeforeSendTransaction func(event *Event, hint *EventHint) *Event - // Before breadcrumb add callback. - BeforeBreadcrumb func(breadcrumb *Breadcrumb, hint *BreadcrumbHint) *Breadcrumb - // Integrations to be installed on the current Client, receives default - // integrations. - Integrations func([]Integration) []Integration - // io.Writer implementation that should be used with the Debug mode. - DebugWriter io.Writer - // The transport to use. Defaults to HTTPTransport. - Transport Transport - // The server name to be reported. - ServerName string - // The release to be sent with events. - // - // Some Sentry features are built around releases, and, thus, reporting - // events with a non-empty release improves the product experience. See - // https://docs.sentry.io/product/releases/. - // - // If Release is not set, the SDK will try to derive a default value - // from environment variables or the Git repository in the working - // directory. - // - // If you distribute a compiled binary, it is recommended to set the - // Release value explicitly at build time. As an example, you can use: - // - // go build -ldflags='-X main.release=VALUE' - // - // That will set the value of a predeclared variable 'release' in the - // 'main' package to 'VALUE'. Then, use that variable when initializing - // the SDK: - // - // sentry.Init(ClientOptions{Release: release}) - // - // See https://golang.org/cmd/go/ and https://golang.org/cmd/link/ for - // the official documentation of -ldflags and -X, respectively. - Release string - // The dist to be sent with events. - Dist string - // The environment to be sent with events. - Environment string - // Maximum number of breadcrumbs - // when MaxBreadcrumbs is negative then ignore breadcrumbs. - MaxBreadcrumbs int - // Maximum number of spans. - // - // See https://develop.sentry.dev/sdk/data-model/envelopes/#size-limits for size limits - // applied during event ingestion. Events that exceed these limits might get dropped. - MaxSpans int - // An optional pointer to http.Client that will be used with a default - // HTTPTransport. Using your own client will make HTTPTransport, HTTPProxy, - // HTTPSProxy and CaCerts options ignored. - HTTPClient *http.Client - // An optional pointer to http.Transport that will be used with a default - // HTTPTransport. Using your own transport will make HTTPProxy, HTTPSProxy - // and CaCerts options ignored. - HTTPTransport http.RoundTripper - // An optional HTTP proxy to use. - // This will default to the HTTP_PROXY environment variable. - HTTPProxy string - // An optional HTTPS proxy to use. - // This will default to the HTTPS_PROXY environment variable. - // HTTPS_PROXY takes precedence over HTTP_PROXY for https requests. - HTTPSProxy string - // An optional set of SSL certificates to use. - CaCerts *x509.CertPool - // MaxErrorDepth is the maximum number of errors reported in a chain of errors. - // This protects the SDK from an arbitrarily long chain of wrapped errors. - // - // An additional consideration is that arguably reporting a long chain of errors - // is of little use when debugging production errors with Sentry. The Sentry UI - // is not optimized for long chains either. The top-level error together with a - // stack trace is often the most useful information. - MaxErrorDepth int -} +go build -ldflags='-X main.release=VALUE' +``` + +That will set the value of a predeclared variable 'release' in the 'main' package to 'VALUE'. Then, use that variable when initializing the SDK: + +```go +sentry.Init(ClientOptions{Release: release}) ``` +See https://golang.org/cmd/go/ and https://golang.org/cmd/link/ for the official documentation of -ldflags and -X, respectively. + + + + + +Sets the distribution of the application. Distributions are used to disambiguate build or deployment variants of the same release of an application. The dist has a max length of 64 characters. + + + + + +Sets the environment. This string is freeform and not set by default. A release can be associated with more than one environment to separate them in the UI (think `staging` vs `prod` or similar). + +By default, the SDK will try to read this value from the `SENTRY_ENVIRONMENT` environment variable. + + + + + +Configures the sample rate for error events, in the range of `0.0` to `1.0`. The default is `1.0`, which means that 100% of error events will be sent. If set to `0.1`, only 10% of error events will be sent. Events are picked randomly. + +As a historical special case, the sample rate `0.0` is treated as if it was `1.0`. To drop all events, set the DSN to the empty string. + + + + + +This variable controls the total amount of breadcrumbs that should be captured. This defaults to `100`, but you can set this to any number. However, you should be aware that Sentry has a [maximum payload size](https://develop.sentry.dev/sdk/data-model/envelopes/#size-limits) and any events exceeding that payload size will be dropped. + +When MaxBreadcrumbs is negative then breadcrumbs are ignored. + + + + + +Maximum number of spans that can be attached to a transaction. + +See https://develop.sentry.dev/sdk/data-model/envelopes/#size-limits for size limits applied during event ingestion. Events that exceed these limits might get dropped. + + + + + +When enabled, stack traces are automatically attached to all messages logged. Stack traces are always attached to errors; however, when this option is set, stack traces are also sent with messages. This option, for instance, means that stack traces appear next to all log messages. + +This option is turned off by default. + +Grouping in Sentry is different for events with stack traces and without. As a result, you will get new groups as you enable or disable this flag for certain events. + + + + + +If this flag is enabled, certain personally identifiable information (PII) is added by active integrations. By default, no such data is sent. + +If you enable this option, be sure to manually remove what you don't want to send using our features for managing [_Sensitive Data_](../../data-management/sensitive-data/). + + + + + +This option can be used to supply a server name. When provided, the name of the server is sent along and persisted in the event. For many integrations, the server name actually corresponds to the device hostname, even in situations where the machine is not actually a server. + +Most SDKs will attempt to auto-discover this value. + + + + + +A list of regexp strings that will be used to match against event's message and if applicable, caught errors type and value. If the match is found, then a whole event will be dropped. + + + + + +A list of regexp strings that will be used to match against a transaction's name. If a match is found, then the transaction will be dropped. + + + + + +This is the maximum number of errors reported in a chain of errors. This protects the SDK from an arbitrarily long chain of wrapped errors. + +An additional consideration is that arguably reporting a long chain of errors is of little use when debugging production errors with Sentry. The Sentry UI is not optimized for long chains either. The top-level error together with a stack trace is often the most useful information. + + + +## Logging Options + + + +Enable structured logging. When enabled, the SDK will capture log messages and send them to Sentry. + + + +## Tracing Options + + + +Enable performance tracing. When enabled, the SDK will create transactions and spans to measure performance. + + + + + +A number between `0.0` and `1.0`, controlling the percentage chance a given transaction will be sent to Sentry (`0.0` represents 0% while `1.0` represents 100%.) Applies equally to all transactions created in the app. + + + + + +Used to customize the sampling of traces, overrides TracesSampleRate. A function responsible for determining the percentage chance a given transaction will be sent to Sentry. It will automatically be passed information about the transaction and the context in which it's being created, and must return a number between `0` (0% chance of being sent) and `1` (100% chance of being sent). Can also be used for filtering transactions, by returning 0 for those that are unwanted. + + + +## Hooks + +These options can be used to hook the SDK in various ways to customize the reporting of events. + + + +This function is called with an SDK-specific message or error event object, and can return a modified event object, or `nil` to skip reporting the event. This can be used, for instance, for manual PII stripping before sending. + +By the time `before-send` is executed, all scope data has already been applied to the event. Further modification of the scope won't have any effect. + + + + + +This function is called with an SDK-specific transaction event object, and can return a modified transaction event object, or `nil` to skip reporting the event. One way this might be used is for manual PII stripping before sending. + + + + + +This function is called with an SDK-specific breadcrumb object before the breadcrumb is added to the scope. When `nil` is returned from the function, the breadcrumb is dropped. To pass the breadcrumb through, return the first argument, which contains the breadcrumb object. +The callback typically gets a second argument (called a "hint") which contains the original object from which the breadcrumb was created to further customize what the breadcrumb should look like. + + + +## Integration Configuration + + + +Integrations to be installed on the current Client, receives default integrations. For more information, please see our documentation for a specific integration. + + + + + +io.Writer implementation that should be used with the Debug mode. + + + +## Transport Options + +Transports are used to send events to Sentry. Transports can be customized to some degree to better support highly specific deployments. + + + +The transport to use. Defaults to HTTPTransport. Switches out the transport used to send events. How this works depends on the SDK. It can, for instance, be used to capture events for unit-testing or to send it through some more complex setup that requires proxy authentication. + + + + + +An optional pointer to http.Client that will be used with a default HTTPTransport. Using your own client will make HTTPTransport, HTTPProxy, HTTPSProxy and CaCerts options ignored. + + + + + +An optional pointer to http.Transport that will be used with a default HTTPTransport. Using your own transport will make HTTPProxy, HTTPSProxy and CaCerts options ignored. + + + + + +When set, a proxy can be configured that should be used for outbound requests. This is also used for HTTPS requests unless a separate `https-proxy` is configured. However, not all SDKs support a separate HTTPS proxy. SDKs will attempt to default to the system-wide configured proxy, if possible. For instance, on Unix systems, the `HTTP_PROXY` environment variable will be picked up. + +This will default to the HTTP_PROXY environment variable. + + + + + +Configures a separate proxy for outgoing HTTPS requests. If this option is not provided but `http-proxy` is, then `http-proxy` is used for HTTPS requests too. + +This will default to the HTTPS_PROXY environment variable. HTTPS_PROXY takes precedence over HTTP_PROXY for https requests. + + + + + +An optional set of SSL certificates to use. + + + ### Providing SSL Certificates By default, TLS uses the host's root CA set. If you don't have `ca-certificates` (which should be your go-to way of fixing the issue of the missing certificates) and want to use `gocertifi` instead, you can provide pre-loaded cert files as one of the options to the `sentry.Init` call: diff --git a/platform-includes/configuration/config-intro/go.mdx b/platform-includes/configuration/config-intro/go.mdx index e8bd7cf3b2dec3..573fd1138190c1 100644 --- a/platform-includes/configuration/config-intro/go.mdx +++ b/platform-includes/configuration/config-intro/go.mdx @@ -3,8 +3,13 @@ Options are passed to the `Init()` method as an instance of `sentry.ClientOption ```go sentry.Init(sentry.ClientOptions{ - Dsn: "___PUBLIC_DSN___", - Debug: true, + Dsn: "___PUBLIC_DSN___", + // Enable printing of SDK debug messages. + // Useful when getting started or trying to figure something out. + Debug: true, + // Adds request headers and IP for users, + // visit: https://docs.sentry.io/platforms/go/data-management/data-collected/ for more info + SendDefaultPII: true, // Release: "my-project-name@1.0.0", }) ``` From c3405146898dac2932f648c80da7b523222dcf6b Mon Sep 17 00:00:00 2001 From: Giannis Gkiortzis Date: Mon, 6 Oct 2025 10:28:55 +0200 Subject: [PATCH 2/4] change options to the new SdkOption element --- .../go/common/configuration/options.mdx | 146 ++++++++++-------- 1 file changed, 80 insertions(+), 66 deletions(-) diff --git a/docs/platforms/go/common/configuration/options.mdx b/docs/platforms/go/common/configuration/options.mdx index 8bd4e93577e11c..07183af9a275f6 100644 --- a/docs/platforms/go/common/configuration/options.mdx +++ b/docs/platforms/go/common/configuration/options.mdx @@ -10,21 +10,21 @@ description: "Learn more about how the SDK can be configured via options. These Options that can be read from an environment variable (`SENTRY_DSN`, `SENTRY_ENVIRONMENT`, `SENTRY_RELEASE`) are read automatically. - + The DSN tells the SDK where to send the events. If this value is not provided, the SDK will try to read it from the `SENTRY_DSN` environment variable. If that variable also does not exist, the SDK will just not send any events. Learn more about [DSN utilization](/product/sentry-basics/dsn-explainer/#dsn-utilization). - + - + If debug is enabled, the SDK will attempt to print out useful debugging information if something goes wrong while sending the event. The default is always `false`. It's generally not recommended to turn it on in production, though turning `debug` mode on will not cause any safety concerns. - + - + Sets the release. Some Sentry features are built around releases, and, thus, reporting events with a non-empty release improves the product experience. See [the releases documentation](/product/releases/). @@ -44,47 +44,49 @@ sentry.Init(ClientOptions{Release: release}) See https://golang.org/cmd/go/ and https://golang.org/cmd/link/ for the official documentation of -ldflags and -X, respectively. - + - + -Sets the distribution of the application. Distributions are used to disambiguate build or deployment variants of the same release of an application. The dist has a max length of 64 characters. +Sets the distribution of the application. Distributions are used to disambiguate build or deployment variants of the same release of an application. For example, the dist can be the build number of an Xcode build or the version code of an Android build. The dist has a max length of 64 characters. - + - + Sets the environment. This string is freeform and not set by default. A release can be associated with more than one environment to separate them in the UI (think `staging` vs `prod` or similar). By default, the SDK will try to read this value from the `SENTRY_ENVIRONMENT` environment variable. - +Environments tell you where an error occurred, whether that's in your production system, your staging server, or elsewhere. Sentry automatically creates an environment when it receives an event with the environment parameter set. - + + + Configures the sample rate for error events, in the range of `0.0` to `1.0`. The default is `1.0`, which means that 100% of error events will be sent. If set to `0.1`, only 10% of error events will be sent. Events are picked randomly. As a historical special case, the sample rate `0.0` is treated as if it was `1.0`. To drop all events, set the DSN to the empty string. - + - + -This variable controls the total amount of breadcrumbs that should be captured. This defaults to `100`, but you can set this to any number. However, you should be aware that Sentry has a [maximum payload size](https://develop.sentry.dev/sdk/data-model/envelopes/#size-limits) and any events exceeding that payload size will be dropped. +This variable controls the total amount of breadcrumbs that should be captured. However, you should be aware that Sentry has a [maximum payload size](https://develop.sentry.dev/sdk/data-model/envelopes/#size-limits) and any events exceeding that payload size will be dropped. When MaxBreadcrumbs is negative then breadcrumbs are ignored. - + - + Maximum number of spans that can be attached to a transaction. See https://develop.sentry.dev/sdk/data-model/envelopes/#size-limits for size limits applied during event ingestion. Events that exceed these limits might get dropped. - + - + When enabled, stack traces are automatically attached to all messages logged. Stack traces are always attached to errors; however, when this option is set, stack traces are also sent with messages. This option, for instance, means that stack traces appear next to all log messages. @@ -92,154 +94,166 @@ This option is turned off by default. Grouping in Sentry is different for events with stack traces and without. As a result, you will get new groups as you enable or disable this flag for certain events. - + - + If this flag is enabled, certain personally identifiable information (PII) is added by active integrations. By default, no such data is sent. If you enable this option, be sure to manually remove what you don't want to send using our features for managing [_Sensitive Data_](../../data-management/sensitive-data/). - + - + This option can be used to supply a server name. When provided, the name of the server is sent along and persisted in the event. For many integrations, the server name actually corresponds to the device hostname, even in situations where the machine is not actually a server. Most SDKs will attempt to auto-discover this value. - + - + A list of regexp strings that will be used to match against event's message and if applicable, caught errors type and value. If the match is found, then a whole event will be dropped. - +By default, no errors are ignored. + + - + A list of regexp strings that will be used to match against a transaction's name. If a match is found, then the transaction will be dropped. - +By default, no transactions are ignored. - + + + This is the maximum number of errors reported in a chain of errors. This protects the SDK from an arbitrarily long chain of wrapped errors. An additional consideration is that arguably reporting a long chain of errors is of little use when debugging production errors with Sentry. The Sentry UI is not optimized for long chains either. The top-level error together with a stack trace is often the most useful information. - + ## Logging Options - + -Enable structured logging. When enabled, the SDK will capture log messages and send them to Sentry. +Set this option to `true` to enable log capturing in Sentry. Only when this is enabled will the SDK capture log messages and send them to Sentry. - + ## Tracing Options - + Enable performance tracing. When enabled, the SDK will create transactions and spans to measure performance. - + + + - +A number between `0.0` and `1.0`, controlling the percentage chance a given transaction will be sent to Sentry (`0.0` represents 0% while `1.0` represents 100%.) Applies equally to all transactions created in the app. Either this or `traces-sampler` must be defined to enable tracing. -A number between `0.0` and `1.0`, controlling the percentage chance a given transaction will be sent to Sentry (`0.0` represents 0% while `1.0` represents 100%.) Applies equally to all transactions created in the app. + - + - +Used to customize the sampling of traces, overrides TracesSampleRate. A function responsible for determining the percentage chance a given transaction will be sent to Sentry. It will automatically be passed information about the transaction and the context in which it's being created, and must return a number between `0` (0% chance of being sent) and `1` (100% chance of being sent). Can also be used for filtering transactions, by returning 0 for those that are unwanted. Either this or `traces-sample-rate` must be defined to enable tracing. -Used to customize the sampling of traces, overrides TracesSampleRate. A function responsible for determining the percentage chance a given transaction will be sent to Sentry. It will automatically be passed information about the transaction and the context in which it's being created, and must return a number between `0` (0% chance of being sent) and `1` (100% chance of being sent). Can also be used for filtering transactions, by returning 0 for those that are unwanted. + - + + +A number between `0.0` and `1.0`, controlling the percentage chance a given sampled transaction will be profiled. (`0.0` represents 0% while `1.0` represents 100%.) Applies equally to all transactions created in the app. This is relative to the tracing sample rate - e.g. `0.5` means 50% of sampled transactions will be profiled. + + ## Hooks These options can be used to hook the SDK in various ways to customize the reporting of events. - + This function is called with an SDK-specific message or error event object, and can return a modified event object, or `nil` to skip reporting the event. This can be used, for instance, for manual PII stripping before sending. By the time `before-send` is executed, all scope data has already been applied to the event. Further modification of the scope won't have any effect. - + - + This function is called with an SDK-specific transaction event object, and can return a modified transaction event object, or `nil` to skip reporting the event. One way this might be used is for manual PII stripping before sending. - + - + This function is called with an SDK-specific breadcrumb object before the breadcrumb is added to the scope. When `nil` is returned from the function, the breadcrumb is dropped. To pass the breadcrumb through, return the first argument, which contains the breadcrumb object. The callback typically gets a second argument (called a "hint") which contains the original object from which the breadcrumb was created to further customize what the breadcrumb should look like. - + ## Integration Configuration - + + +Integrations to be installed on the current Client, receives default integrations. This function can be used to add additional integrations or remove default integrations. For more information, please see our documentation for a specific integration. -Integrations to be installed on the current Client, receives default integrations. For more information, please see our documentation for a specific integration. +See the [Removing Default Integrations](#removing-default-integrations) section below for an example. - + - + -io.Writer implementation that should be used with the Debug mode. +io.Writer implementation that should be used with the Debug mode. This allows you to redirect debug output to a custom writer instead of stdout. - + ## Transport Options Transports are used to send events to Sentry. Transports can be customized to some degree to better support highly specific deployments. - + The transport to use. Defaults to HTTPTransport. Switches out the transport used to send events. How this works depends on the SDK. It can, for instance, be used to capture events for unit-testing or to send it through some more complex setup that requires proxy authentication. - + - + An optional pointer to http.Client that will be used with a default HTTPTransport. Using your own client will make HTTPTransport, HTTPProxy, HTTPSProxy and CaCerts options ignored. - + - + An optional pointer to http.Transport that will be used with a default HTTPTransport. Using your own transport will make HTTPProxy, HTTPSProxy and CaCerts options ignored. - + - + When set, a proxy can be configured that should be used for outbound requests. This is also used for HTTPS requests unless a separate `https-proxy` is configured. However, not all SDKs support a separate HTTPS proxy. SDKs will attempt to default to the system-wide configured proxy, if possible. For instance, on Unix systems, the `HTTP_PROXY` environment variable will be picked up. This will default to the HTTP_PROXY environment variable. - + - + Configures a separate proxy for outgoing HTTPS requests. If this option is not provided but `http-proxy` is, then `http-proxy` is used for HTTPS requests too. This will default to the HTTPS_PROXY environment variable. HTTPS_PROXY takes precedence over HTTP_PROXY for https requests. - + - + -An optional set of SSL certificates to use. +An optional set of SSL certificates to use. See the [Providing SSL Certificates](#providing-ssl-certificates) section below for an example. - + ### Providing SSL Certificates From 4327cf5aec15ec356ebda751a89d00aa3df8653e Mon Sep 17 00:00:00 2001 From: Giannis Gkiortzis Date: Mon, 6 Oct 2025 11:33:09 +0200 Subject: [PATCH 3/4] change maxErrorDepth default --- docs/platforms/go/common/configuration/options.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/platforms/go/common/configuration/options.mdx b/docs/platforms/go/common/configuration/options.mdx index 07183af9a275f6..152c9ef297b6ba 100644 --- a/docs/platforms/go/common/configuration/options.mdx +++ b/docs/platforms/go/common/configuration/options.mdx @@ -128,7 +128,7 @@ By default, no transactions are ignored. - + This is the maximum number of errors reported in a chain of errors. This protects the SDK from an arbitrarily long chain of wrapped errors. From 0b10f11943231910ef32bf533f584f189d852811 Mon Sep 17 00:00:00 2001 From: Giannis Gkiortzis Date: Mon, 6 Oct 2025 13:06:01 +0200 Subject: [PATCH 4/4] change options to CamelCase --- .../go/common/configuration/options.mdx | 95 ++++++++++--------- 1 file changed, 49 insertions(+), 46 deletions(-) diff --git a/docs/platforms/go/common/configuration/options.mdx b/docs/platforms/go/common/configuration/options.mdx index 152c9ef297b6ba..657864a484d9b0 100644 --- a/docs/platforms/go/common/configuration/options.mdx +++ b/docs/platforms/go/common/configuration/options.mdx @@ -10,7 +10,7 @@ description: "Learn more about how the SDK can be configured via options. These Options that can be read from an environment variable (`SENTRY_DSN`, `SENTRY_ENVIRONMENT`, `SENTRY_RELEASE`) are read automatically. - + The DSN tells the SDK where to send the events. If this value is not provided, the SDK will try to read it from the `SENTRY_DSN` environment variable. If that variable also does not exist, the SDK will just not send any events. @@ -18,13 +18,13 @@ Learn more about [DSN utilization](/product/sentry-basics/dsn-explainer/#dsn-uti - + If debug is enabled, the SDK will attempt to print out useful debugging information if something goes wrong while sending the event. The default is always `false`. It's generally not recommended to turn it on in production, though turning `debug` mode on will not cause any safety concerns. - + Sets the release. Some Sentry features are built around releases, and, thus, reporting events with a non-empty release improves the product experience. See [the releases documentation](/product/releases/). @@ -46,13 +46,13 @@ See https://golang.org/cmd/go/ and https://golang.org/cmd/link/ for the official - + Sets the distribution of the application. Distributions are used to disambiguate build or deployment variants of the same release of an application. For example, the dist can be the build number of an Xcode build or the version code of an Android build. The dist has a max length of 64 characters. - + Sets the environment. This string is freeform and not set by default. A release can be associated with more than one environment to separate them in the UI (think `staging` vs `prod` or similar). @@ -62,7 +62,7 @@ Environments tell you where an error occurred, whether that's in your production - + Configures the sample rate for error events, in the range of `0.0` to `1.0`. The default is `1.0`, which means that 100% of error events will be sent. If set to `0.1`, only 10% of error events will be sent. Events are picked randomly. @@ -70,7 +70,7 @@ As a historical special case, the sample rate `0.0` is treated as if it was `1.0 - + This variable controls the total amount of breadcrumbs that should be captured. However, you should be aware that Sentry has a [maximum payload size](https://develop.sentry.dev/sdk/data-model/envelopes/#size-limits) and any events exceeding that payload size will be dropped. @@ -78,15 +78,7 @@ When MaxBreadcrumbs is negative then breadcrumbs are ignored. - - -Maximum number of spans that can be attached to a transaction. - -See https://develop.sentry.dev/sdk/data-model/envelopes/#size-limits for size limits applied during event ingestion. Events that exceed these limits might get dropped. - - - - + When enabled, stack traces are automatically attached to all messages logged. Stack traces are always attached to errors; however, when this option is set, stack traces are also sent with messages. This option, for instance, means that stack traces appear next to all log messages. @@ -96,7 +88,7 @@ Grouping in Sentry is different for events with stack traces and without. As a r - + If this flag is enabled, certain personally identifiable information (PII) is added by active integrations. By default, no such data is sent. @@ -104,7 +96,7 @@ If you enable this option, be sure to manually remove what you don't want to sen - + This option can be used to supply a server name. When provided, the name of the server is sent along and persisted in the event. For many integrations, the server name actually corresponds to the device hostname, even in situations where the machine is not actually a server. @@ -112,7 +104,7 @@ Most SDKs will attempt to auto-discover this value. - + A list of regexp strings that will be used to match against event's message and if applicable, caught errors type and value. If the match is found, then a whole event will be dropped. @@ -120,15 +112,9 @@ By default, no errors are ignored. - -A list of regexp strings that will be used to match against a transaction's name. If a match is found, then the transaction will be dropped. - -By default, no transactions are ignored. - - - + This is the maximum number of errors reported in a chain of errors. This protects the SDK from an arbitrarily long chain of wrapped errors. @@ -138,7 +124,7 @@ An additional consideration is that arguably reporting a long chain of errors is ## Logging Options - + Set this option to `true` to enable log capturing in Sentry. Only when this is enabled will the SDK capture log messages and send them to Sentry. @@ -146,49 +132,66 @@ Set this option to `true` to enable log capturing in Sentry. Only when this is e ## Tracing Options - + Enable performance tracing. When enabled, the SDK will create transactions and spans to measure performance. - + A number between `0.0` and `1.0`, controlling the percentage chance a given transaction will be sent to Sentry (`0.0` represents 0% while `1.0` represents 100%.) Applies equally to all transactions created in the app. Either this or `traces-sampler` must be defined to enable tracing. - + -Used to customize the sampling of traces, overrides TracesSampleRate. A function responsible for determining the percentage chance a given transaction will be sent to Sentry. It will automatically be passed information about the transaction and the context in which it's being created, and must return a number between `0` (0% chance of being sent) and `1` (100% chance of being sent). Can also be used for filtering transactions, by returning 0 for those that are unwanted. Either this or `traces-sample-rate` must be defined to enable tracing. +Used to customize the sampling of traces, overrides TracesSampleRate. A function responsible for determining the percentage chance a given transaction will be sent to Sentry. It will automatically be passed information about the transaction and the context in which it's being created, and must return a number between `0` (0% chance of being sent) and `1` (100% chance of being sent). Can also be used for filtering transactions, by returning 0 for those that are unwanted. Either this or `TracesSampleRate` must be defined to enable tracing. - + A number between `0.0` and `1.0`, controlling the percentage chance a given sampled transaction will be profiled. (`0.0` represents 0% while `1.0` represents 100%.) Applies equally to all transactions created in the app. This is relative to the tracing sample rate - e.g. `0.5` means 50% of sampled transactions will be profiled. + + +Maximum number of spans that can be attached to a transaction. + +See https://develop.sentry.dev/sdk/data-model/envelopes/#size-limits for size limits applied during event ingestion. Events that exceed these limits might get dropped. + + + + + + +A list of regexp strings that will be used to match against a transaction's name. If a match is found, then the transaction will be dropped. + +By default, no transactions are ignored. + + + ## Hooks These options can be used to hook the SDK in various ways to customize the reporting of events. - + This function is called with an SDK-specific message or error event object, and can return a modified event object, or `nil` to skip reporting the event. This can be used, for instance, for manual PII stripping before sending. -By the time `before-send` is executed, all scope data has already been applied to the event. Further modification of the scope won't have any effect. +By the time `BeforeSend` is executed, all scope data has already been applied to the event. Further modification of the scope won't have any effect. - + This function is called with an SDK-specific transaction event object, and can return a modified transaction event object, or `nil` to skip reporting the event. One way this might be used is for manual PII stripping before sending. - + This function is called with an SDK-specific breadcrumb object before the breadcrumb is added to the scope. When `nil` is returned from the function, the breadcrumb is dropped. To pass the breadcrumb through, return the first argument, which contains the breadcrumb object. The callback typically gets a second argument (called a "hint") which contains the original object from which the breadcrumb was created to further customize what the breadcrumb should look like. @@ -197,7 +200,7 @@ The callback typically gets a second argument (called a "hint") which contains t ## Integration Configuration - + Integrations to be installed on the current Client, receives default integrations. This function can be used to add additional integrations or remove default integrations. For more information, please see our documentation for a specific integration. @@ -205,7 +208,7 @@ See the [Removing Default Integrations](#removing-default-integrations) section - + io.Writer implementation that should be used with the Debug mode. This allows you to redirect debug output to a custom writer instead of stdout. @@ -215,41 +218,41 @@ io.Writer implementation that should be used with the Debug mode. This allows yo Transports are used to send events to Sentry. Transports can be customized to some degree to better support highly specific deployments. - + The transport to use. Defaults to HTTPTransport. Switches out the transport used to send events. How this works depends on the SDK. It can, for instance, be used to capture events for unit-testing or to send it through some more complex setup that requires proxy authentication. - + An optional pointer to http.Client that will be used with a default HTTPTransport. Using your own client will make HTTPTransport, HTTPProxy, HTTPSProxy and CaCerts options ignored. - + An optional pointer to http.Transport that will be used with a default HTTPTransport. Using your own transport will make HTTPProxy, HTTPSProxy and CaCerts options ignored. - + -When set, a proxy can be configured that should be used for outbound requests. This is also used for HTTPS requests unless a separate `https-proxy` is configured. However, not all SDKs support a separate HTTPS proxy. SDKs will attempt to default to the system-wide configured proxy, if possible. For instance, on Unix systems, the `HTTP_PROXY` environment variable will be picked up. +When set, a proxy can be configured that should be used for outbound requests. This is also used for HTTPS requests unless a separate `HTTPSProxy` is configured. However, not all SDKs support a separate HTTPS proxy. SDKs will attempt to default to the system-wide configured proxy, if possible. For instance, on Unix systems, the `HTTP_PROXY` environment variable will be picked up. This will default to the HTTP_PROXY environment variable. - + -Configures a separate proxy for outgoing HTTPS requests. If this option is not provided but `http-proxy` is, then `http-proxy` is used for HTTPS requests too. +Configures a separate proxy for outgoing HTTPS requests. If this option is not provided but `HTTPProxy` is, then `HTTPProxy` is used for HTTPS requests too. This will default to the HTTPS_PROXY environment variable. HTTPS_PROXY takes precedence over HTTP_PROXY for https requests. - + An optional set of SSL certificates to use. See the [Providing SSL Certificates](#providing-ssl-certificates) section below for an example.