Struct sentry::ClientInitGuard
source · [−]pub struct ClientInitGuard(_);
Expand description
Helper struct that is returned from init
.
When this is dropped events are drained with the configured shutdown_timeout
.
Implementations
sourceimpl ClientInitGuard
impl ClientInitGuard
sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Quick check if the client is enabled.
Methods from Deref<Target = Client>
sourcepub fn options(&self) -> &ClientOptions
pub fn options(&self) -> &ClientOptions
Returns the options of this client.
sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
Quick check to see if the client is enabled.
The Client is enabled if it has a valid DSN and Transport configured.
Examples
use std::sync::Arc;
let client = sentry::Client::from(sentry::ClientOptions::default());
assert!(!client.is_enabled());
let dsn = "https://public@example.com/1";
let transport = sentry::test::TestTransport::new();
let client = sentry::Client::from((
dsn,
sentry::ClientOptions {
transport: Some(Arc::new(transport)),
..Default::default()
},
));
assert!(client.is_enabled());
sourcepub fn capture_event(
&self,
event: Event<'static>,
scope: Option<&Scope>
) -> Uuid
pub fn capture_event(
&self,
event: Event<'static>,
scope: Option<&Scope>
) -> Uuid
Captures an event and sends it to sentry.
sourcepub fn send_envelope(&self, envelope: Envelope)
pub fn send_envelope(&self, envelope: Envelope)
Sends the specified Envelope
to sentry.
sourcepub fn flush(&self, timeout: Option<Duration>) -> bool
pub fn flush(&self, timeout: Option<Duration>) -> bool
Drains all pending events without shutting down.
sourcepub fn close(&self, timeout: Option<Duration>) -> bool
pub fn close(&self, timeout: Option<Duration>) -> bool
Drains all pending events and shuts down the transport behind the client. After shutting down the transport is removed.
This returns true
if the queue was successfully drained in the
given time or false
if not (for instance because of a timeout).
If no timeout is provided the client will wait for as long a
shutdown_timeout
in the client options.
sourcepub fn sample_traces_should_send(&self) -> bool
pub fn sample_traces_should_send(&self) -> bool
Returns a random boolean with a probability defined
by the ClientOptions
’s traces_sample_rate
Trait Implementations
sourceimpl Deref for ClientInitGuard
impl Deref for ClientInitGuard
Auto Trait Implementations
impl RefUnwindSafe for ClientInitGuard
impl Send for ClientInitGuard
impl Sync for ClientInitGuard
impl Unpin for ClientInitGuard
impl UnwindSafe for ClientInitGuard
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
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
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more