Function sentry::apply_defaults
source · pub fn apply_defaults(opts: ClientOptions) -> ClientOptions
Expand description
Apply default client options.
Extends the given ClientOptions
with default options such as a default
transport, a set of default integrations if not requested otherwise, and
also sets the dsn
, release
, environment
, and proxy settings based on
environment variables.
When the ClientOptions::default_integrations
option is set to
true
(the default), the following integrations will be added before
any manually defined integrations, depending on enabled feature flags:
AttachStacktraceIntegration
(feature = "backtrace"
)DebugImagesIntegration
(feature = "debug-images"
)ContextIntegration
(feature = "contexts"
)PanicIntegration
(feature = "panic"
)ProcessStacktraceIntegration
(feature = "backtrace"
)
Some integrations can be used multiple times, however, the
PanicIntegration
can not, and it will not pick up custom panic
extractors when it is defined multiple times.
§Examples
std::env::set_var("SENTRY_RELEASE", "release-from-env");
let options = sentry::ClientOptions::default();
assert_eq!(options.release, None);
assert!(options.transport.is_none());
let options = sentry::apply_defaults(options);
assert_eq!(options.release, Some("release-from-env".into()));
assert!(options.transport.is_some());