Struct ClientOptions
pub struct ClientOptions {Show 30 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 + Send + Sync>>,
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>> + Send + Sync>>,
pub before_breadcrumb: Option<Arc<dyn Fn(Breadcrumb) -> Option<Breadcrumb> + Send + Sync>>,
pub before_send_log: Option<Arc<dyn Fn(Log) -> Option<Log> + Send + Sync>>,
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 enable_metrics: bool,
pub before_send_metric: Option<Arc<dyn Fn(Metric) -> Option<Metric> + Send + Sync>>,
pub accept_invalid_certs: bool,
pub auto_session_tracking: bool,
pub session_mode: SessionMode,
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::new().debug(true);Fields§
§dsn: Option<Dsn>The DSN to use.
See dsn for details.
debug: boolEnables debug mode.
See debug for details.
release: Option<Cow<'static, str>>The release to be sent with events.
See release for details.
environment: Option<Cow<'static, str>>The environment to be sent with events.
See environment for details.
sample_rate: f32The sample rate for event submission.
See sample_rate for details.
traces_sample_rate: f32The sample rate for tracing transactions.
See traces_sample_rate for details.
traces_sampler: Option<Arc<dyn Fn(&TransactionContext) -> f32 + Send + Sync>>The sampler callback for tracing transactions.
See traces_sampler for details.
Maximum number of breadcrumbs.
See max_breadcrumbs for details.
attach_stacktrace: boolAttaches stacktraces to messages.
See attach_stacktrace for details.
send_default_pii: boolWhether to send default PII.
See send_default_pii for details.
server_name: Option<Cow<'static, str>>The server name to be reported.
See server_name for details.
in_app_include: Vec<&'static str>Module prefixes that are always considered “in_app”.
See in_app_include for details.
in_app_exclude: Vec<&'static str>Module prefixes that are never “in_app”.
See in_app_exclude for details.
integrations: Vec<Arc<dyn Integration>>A list of integrations to enable.
See integrations and
add_integration for details.
default_integrations: boolWhether to add default integrations.
See default_integrations for details.
before_send: Option<Arc<dyn Fn(Event<'static>) -> Option<Event<'static>> + Send + Sync>>Callback that is executed before event sending.
See before_send for details.
Callback that is executed for each Breadcrumb being added.
See before_breadcrumb for details.
before_send_log: Option<Arc<dyn Fn(Log) -> Option<Log> + Send + Sync>>Callback that is executed for each Log being added.
See before_send_log for details.
transport: Option<Arc<dyn TransportFactory>>The transport to use.
See transport for details.
http_proxy: Option<Cow<'static, str>>An optional HTTP proxy to use.
See http_proxy for details.
https_proxy: Option<Cow<'static, str>>An optional HTTPS proxy to use.
See https_proxy for details.
shutdown_timeout: DurationThe timeout on client drop for draining events on shutdown.
See shutdown_timeout for details.
max_request_body_size: MaxRequestBodySizeThe maximum size of an HTTP request body to capture.
See max_request_body_size for details.
enable_logs: boolWhether captured structured logs should be sent to Sentry.
See enable_logs for details.
enable_metrics: boolWhether metric capture APIs should capture metrics.
See enable_metrics for details.
before_send_metric: Option<Arc<dyn Fn(Metric) -> Option<Metric> + Send + Sync>>Callback that is executed for each Metric before sending.
See before_send_metric for details.
accept_invalid_certs: boolWhether to disable SSL verification.
See accept_invalid_certs for details.
auto_session_tracking: boolWhether Release Health Session tracking is enabled.
See auto_session_tracking for details.
session_mode: SessionModeDetermine how Sessions are being tracked.
See session_mode for details.
user_agent: Cow<'static, str>The user agent that should be reported.
See user_agent for details.
Implementations§
§impl ClientOptions
impl ClientOptions
pub fn new() -> ClientOptions
pub fn new() -> ClientOptions
Creates new Options.
pub fn dsn(self, dsn: &str) -> ClientOptions
pub fn dsn(self, dsn: &str) -> ClientOptions
pub fn debug(self, debug: bool) -> ClientOptions
pub fn debug(self, debug: bool) -> ClientOptions
Enables or disables debug mode.
In debug mode debug information is printed to stderr to help you understand what sentry is
doing. Defaults to false.
pub fn release<T>(self, release: T) -> ClientOptions
pub fn release<T>(self, release: T) -> ClientOptions
Sets the release to be sent with events.
pub fn maybe_release<T>(self, release: Option<T>) -> ClientOptions
pub fn maybe_release<T>(self, release: Option<T>) -> ClientOptions
Sets the release to be sent with events if one is provided.
Use this with release_name!, which returns the release as an
Option.
pub fn environment<T>(self, environment: T) -> ClientOptions
pub fn environment<T>(self, environment: T) -> ClientOptions
Sets the environment to be sent with events.
Defaults to either "development" or "production" depending on the debug_assertions
cfg-attribute.
pub fn sample_rate(self, sample_rate: f32) -> ClientOptions
pub fn sample_rate(self, sample_rate: f32) -> ClientOptions
Sets the sample rate for event submission.
Must be between 0.0 and 1.0. Defaults to 1.0.
§Panics
Panics if the sample_rate is outside the allowed range.
pub fn traces_sample_rate(self, traces_sample_rate: f32) -> ClientOptions
pub fn traces_sample_rate(self, traces_sample_rate: f32) -> ClientOptions
Sets the sample rate for tracing transactions.
Must be between 0.0 and 1.0. Defaults to 0.0.
§Panics
Panics if the traces_sample_rate is outside the allowed range.
pub fn traces_sampler<F>(self, traces_sampler: F) -> ClientOptions
pub fn traces_sampler<F>(self, traces_sampler: F) -> ClientOptions
Sets the sampler callback for tracing transactions.
Return a sample rate between 0.0 and 1.0 for the transaction in question. Takes
priority over traces_sample_rate.
Sets the maximum number of breadcrumbs.
Defaults to 100.
pub fn attach_stacktrace(self, attach_stacktrace: bool) -> ClientOptions
pub fn attach_stacktrace(self, attach_stacktrace: bool) -> ClientOptions
Enables or disables attaching stacktraces to messages.
Defaults to false.
pub fn send_default_pii(self, send_default_pii: bool) -> ClientOptions
pub fn send_default_pii(self, send_default_pii: bool) -> ClientOptions
Enables or disables sending default PII.
This includes information such as potentially sensitive HTTP headers and user IP addresses
in HTTP server integrations. Defaults to false.
pub fn server_name<T>(self, server_name: T) -> ClientOptions
pub fn server_name<T>(self, server_name: T) -> ClientOptions
Sets the server name to be reported.
pub fn in_app_include<I>(self, in_app_include: I) -> ClientOptionswhere
I: IntoIterator<Item = &'static str>,
pub fn in_app_include<I>(self, in_app_include: I) -> ClientOptionswhere
I: IntoIterator<Item = &'static str>,
Sets module prefixes that are always considered in-app.
pub fn in_app_exclude<I>(self, in_app_exclude: I) -> ClientOptionswhere
I: IntoIterator<Item = &'static str>,
pub fn in_app_exclude<I>(self, in_app_exclude: I) -> ClientOptionswhere
I: IntoIterator<Item = &'static str>,
Sets module prefixes that are never considered in-app.
pub fn integrations<I>(self, integrations: I) -> ClientOptions
pub fn integrations<I>(self, integrations: I) -> ClientOptions
Sets the integrations to enable, replacing the existing list.
See sentry::integrations for how to
use this to enable extra integrations. Use
add_integration to append.
pub fn default_integrations(self, default_integrations: bool) -> ClientOptions
pub fn default_integrations(self, default_integrations: bool) -> ClientOptions
Enables or disables default integrations.
See sentry::integrations for details.
Defaults to true.
pub fn before_send<F>(self, before_send: F) -> ClientOptions
pub fn before_send<F>(self, before_send: F) -> ClientOptions
Sets the callback that is executed before event sending.
Sets the callback that is executed before adding each breadcrumb.
pub fn before_send_log<F>(self, before_send_log: F) -> ClientOptions
pub fn before_send_log<F>(self, before_send_log: F) -> ClientOptions
Sets the callback that is executed before sending each log.
pub fn transport<T>(self, transport: T) -> ClientOptionswhere
T: TransportFactory + 'static,
pub fn transport<T>(self, transport: T) -> ClientOptionswhere
T: TransportFactory + 'static,
Sets the transport to use.
This is typically either a function taking the client options by reference and returning a
transport, an Arc<Transport>, or the DefaultTransportFactory. Types that do not
implement TransportFactory use direct field assignment.
pub fn http_proxy<T>(self, http_proxy: T) -> ClientOptions
pub fn http_proxy<T>(self, http_proxy: T) -> ClientOptions
Sets the optional HTTP proxy to use.
This defaults to the http_proxy environment variable.
pub fn https_proxy<T>(self, https_proxy: T) -> ClientOptions
pub fn https_proxy<T>(self, https_proxy: T) -> ClientOptions
Sets the optional HTTPS proxy to use.
This defaults to the HTTPS_PROXY environment variable, or http_proxy if that one
exists.
pub fn shutdown_timeout(self, shutdown_timeout: Duration) -> ClientOptions
pub fn shutdown_timeout(self, shutdown_timeout: Duration) -> ClientOptions
Sets the shutdown drain timeout.
Defaults to 2 seconds.
pub fn max_request_body_size(
self,
max_request_body_size: MaxRequestBodySize,
) -> ClientOptions
pub fn max_request_body_size( self, max_request_body_size: MaxRequestBodySize, ) -> ClientOptions
Sets the maximum request body size to capture.
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. Defaults to MaxRequestBodySize::Medium.
pub fn enable_logs(self, enable_logs: bool) -> ClientOptions
pub fn enable_logs(self, enable_logs: bool) -> ClientOptions
Enables or disables sending structured logs.
The logs feature is required to capture logs. Defaults to true.
pub fn enable_metrics(self, enable_metrics: bool) -> ClientOptions
pub fn enable_metrics(self, enable_metrics: bool) -> ClientOptions
Enables or disables metric capture APIs.
The metrics feature is required to capture metrics. Defaults to true.
pub fn accept_invalid_certs(self, accept_invalid_certs: bool) -> ClientOptions
pub fn accept_invalid_certs(self, accept_invalid_certs: bool) -> ClientOptions
Enables or disables accepting invalid TLS certificates.
This introduces significant vulnerabilities, and should only be used as a last resort.
Defaults to false.
pub fn user_agent<T>(self, user_agent: T) -> ClientOptions
pub fn user_agent<T>(self, user_agent: T) -> ClientOptions
Sets the user agent that should be reported.
Defaults to the SDK user agent.
pub fn add_integration<I>(self, integration: I) -> ClientOptionswhere
I: Integration,
pub fn add_integration<I>(self, integration: I) -> ClientOptionswhere
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
impl Clone for ClientOptions
§fn clone(&self) -> ClientOptions
fn clone(&self) -> ClientOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for ClientOptions
impl Debug for ClientOptions
§impl Default for ClientOptions
impl Default for ClientOptions
§fn default() -> ClientOptions
fn default() -> ClientOptions
§impl<T> From<(T, ClientOptions)> for ClientOptionswhere
T: IntoDsn,
impl<T> From<(T, ClientOptions)> for ClientOptionswhere
T: IntoDsn,
§fn from(_: (T, ClientOptions)) -> ClientOptions
fn from(_: (T, ClientOptions)) -> ClientOptions
§impl<T> From<T> for ClientOptionswhere
T: IntoDsn,
impl<T> From<T> for ClientOptionswhere
T: IntoDsn,
§fn from(into_dsn: T) -> ClientOptions
fn from(into_dsn: T) -> ClientOptions
Auto Trait Implementations§
impl Freeze for ClientOptions
impl !RefUnwindSafe for ClientOptions
impl Send for ClientOptions
impl Sync for ClientOptions
impl Unpin for ClientOptions
impl UnsafeUnpin for ClientOptions
impl !UnwindSafe for ClientOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more