Configuration
Deprecation Warning
A new Go SDK has superseded this deprecated version. Sentry preserves this documentation for customers using the old raven-go
client. Learn more about the project on GitHub and check out our migration guide.
The Sentry Go SDK has some configurable options, which can enhance your user experience, as well as helping you streamline your error tracking.
The DSN tells the SDK where to send the events. This option is always required and the Sentry Go SDKs can pick this up from an environment variable (SENTRY_DSN
). When set to an empty string, SDK won't send any events to Sentry, and all Capture*
methods will effectively act as no-ops.
raven.SetDSN("https://examplePublicKey@o0.ingest.sentry.io/0")
The logger name used for the events.
raven.SetDefaultLoggerName("some_logger_name")
Outputs some debug logs for capturing and sending events.
raven.SetDebug(true)
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).
raven.SetEnvironment("staging")
Sets the release. Release names are just strings, but the Sentry SDK may detect some formats, and the format might render differently. For more information have a look at the releases documentation.
raven.SetRelease("my-project-name@1.0.0")
Configures the sample rate as a percentage of events to be sent in the range of 0.0
to 1.0
. The default is 1.0
which means that the SDK sends 100% of the events. If set to 0.1
only 10% of the events will be sent. The Sentry SDK picks events randomly.
raven.SetSampleRate(0.2)
A list of messages to be filtered out before being sent to Sentry. This list will form a RegExp, that will check for a partial match of either error's message or the message directly passed by the user.
raven.SetIgnoreErrors([]string{"ThirdPartyServiceUnavailable", "Other error that we want to ignore"})
A list of string prefixes of module names that belong to the app. This option will be used to determine whether the Sentry SDK should mark the frame as the user's or native/external code.
raven.SetIncludePaths([]string{"/some/path", "other/path"})
Our documentation is open source and available on GitHub. Your contributions are welcome, whether fixing a typo (drat!) or suggesting an update ("yeah, this would be better").