Skip to main content

ClientOptions

Struct ClientOptions 

pub struct ClientOptions {
Show 26 fields pub dsn: Option<Dsn>, pub debug: bool, pub release: Option<Cow<'static, str>>, pub environment: Option<Cow<'static, str>>, pub sample_rate: f32, pub traces_sample_rate: f32, pub traces_sampler: Option<Arc<dyn Fn(&TransactionContext) -> f32 + Sync + Send>>, pub max_breadcrumbs: usize, pub attach_stacktrace: bool, pub send_default_pii: bool, pub server_name: Option<Cow<'static, str>>, pub in_app_include: Vec<&'static str>, pub in_app_exclude: Vec<&'static str>, pub integrations: Vec<Arc<dyn Integration>>, pub default_integrations: bool, pub before_send: Option<Arc<dyn Fn(Event<'static>) -> Option<Event<'static>> + Sync + Send>>, pub before_breadcrumb: Option<Arc<dyn Fn(Breadcrumb) -> Option<Breadcrumb> + Sync + Send>>, pub before_send_log: Option<Arc<dyn Fn(Log) -> Option<Log> + Sync + Send>>, pub transport: Option<Arc<dyn TransportFactory>>, pub http_proxy: Option<Cow<'static, str>>, pub https_proxy: Option<Cow<'static, str>>, pub shutdown_timeout: Duration, pub max_request_body_size: MaxRequestBodySize, pub enable_logs: bool, pub accept_invalid_certs: bool, pub user_agent: Cow<'static, str>,
}
Expand description

Configuration settings for the client.

These options are explained in more detail in the general sentry documentation.

§Examples

let _options = sentry::ClientOptions {
    debug: true,
    ..Default::default()
};

Fields§

§dsn: Option<Dsn>

The DSN to use. If not set the client is effectively disabled.

§debug: bool

Enables debug mode.

In debug mode debug information is printed to stderr to help you understand what sentry is doing.

§release: Option<Cow<'static, str>>

The release to be sent with events.

§environment: Option<Cow<'static, str>>

The environment to be sent with events.

Defaults to either "development" or "production" depending on the debug_assertions cfg-attribute.

§sample_rate: f32

The sample rate for event submission. (0.0 - 1.0, defaults to 1.0)

§traces_sample_rate: f32

The sample rate for tracing transactions. (0.0 - 1.0, defaults to 0.0)

§traces_sampler: Option<Arc<dyn Fn(&TransactionContext) -> f32 + Sync + Send>>

If given, called with a SamplingContext for each transaction to determine the sampling rate.

Return a sample rate between 0.0 and 1.0 for the transaction in question. Takes priority over the sample_rate.

§max_breadcrumbs: usize

Maximum number of breadcrumbs. (defaults to 100)

§attach_stacktrace: bool

Attaches stacktraces to messages.

§send_default_pii: bool

If turned on, some information that can be considered PII is captured, such as potentially sensitive HTTP headers and user IP address in HTTP server integrations.

§server_name: Option<Cow<'static, str>>

The server name to be reported.

§in_app_include: Vec<&'static str>

Module prefixes that are always considered “in_app”.

§in_app_exclude: Vec<&'static str>

Module prefixes that are never “in_app”.

§integrations: Vec<Arc<dyn Integration>>

A list of integrations to enable.

See sentry::integrations for how to use this to enable extra integrations.

§default_integrations: bool

Whether to add default integrations.

See sentry::integrations for details how this works and interacts with manually installed integrations.

§before_send: Option<Arc<dyn Fn(Event<'static>) -> Option<Event<'static>> + Sync + Send>>

Callback that is executed before event sending.

§before_breadcrumb: Option<Arc<dyn Fn(Breadcrumb) -> Option<Breadcrumb> + Sync + Send>>

Callback that is executed for each Breadcrumb being added.

§before_send_log: Option<Arc<dyn Fn(Log) -> Option<Log> + Sync + Send>>

Callback that is executed for each Log being added.

§transport: Option<Arc<dyn TransportFactory>>

The transport to use.

This is typically either a boxed function taking the client options by reference and returning a Transport, a boxed Arc<Transport> or alternatively the DefaultTransportFactory.

§http_proxy: Option<Cow<'static, str>>

An optional HTTP proxy to use.

This will default to the http_proxy environment variable.

§https_proxy: Option<Cow<'static, str>>

An optional HTTPS proxy to use.

This will default to the HTTPS_PROXY environment variable or http_proxy if that one exists.

§shutdown_timeout: Duration

The timeout on client drop for draining events on shutdown.

§max_request_body_size: MaxRequestBodySize

Controls the maximum size of an HTTP request body that can be captured when using HTTP server integrations. Needs send_default_pii to be enabled to have any effect.

§enable_logs: bool

Determines whether captured structured logs should be sent to Sentry (defaults to false).

§accept_invalid_certs: bool

Disable SSL verification.

§Warning

This introduces significant vulnerabilities, and should only be used as a last resort.

§user_agent: Cow<'static, str>

The user agent that should be reported.

Implementations§

§

impl ClientOptions

pub fn new() -> ClientOptions

Creates new Options.

pub fn add_integration<I>(self, integration: I) -> ClientOptions
where I: Integration,

Adds a configured integration to the options.

§Examples
struct MyIntegration;

impl sentry::Integration for MyIntegration {}

let options = sentry::ClientOptions::new().add_integration(MyIntegration);
assert_eq!(options.integrations.len(), 1);

Trait Implementations§

§

impl Clone for ClientOptions

§

fn clone(&self) -> ClientOptions

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl Debug for ClientOptions

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl Default for ClientOptions

§

fn default() -> ClientOptions

Returns the “default value” for a type. Read more
§

impl<T> From<(T, ClientOptions)> for ClientOptions
where T: IntoDsn,

§

fn from(_: (T, ClientOptions)) -> ClientOptions

Converts to this type from the input type.
§

impl<T> From<T> for ClientOptions
where T: IntoDsn,

§

fn from(into_dsn: T) -> ClientOptions

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T