[][src]Function sentry::internals::apply_defaults

pub fn apply_defaults(opts: ClientOptions) -> ClientOptions

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 default_integrations option is set to true (by default), the following integrations will be added before any manually defined integrations, depending on enabled feature flags:

  1. AttachStacktraceIntegration (feature = "backtrace")
  2. DebugImagesIntegration (feature = "debug-images")
  3. ErrorChainIntegration (feature = "error-chain")
  4. ContextIntegration (feature = "contexts")
  5. FailureIntegration (feature = "failure")
  6. PanicIntegration (feature = "panic")
  7. 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());