Struct Span
pub struct Span { /* private fields */ }Expand description
A running Performance Monitoring Span.
The span needs to be explicitly finished via Span::finish, otherwise it
will not be sent to Sentry.
Implementations§
§impl Span
impl Span
pub fn set_data(&self, key: &str, value: Value)
pub fn set_data(&self, key: &str, value: Value)
Set some extra information to be sent with this Transaction.
pub fn data(&self) -> Data<'_>
pub fn data(&self) -> Data<'_>
Returns a smart pointer to the span’s data field.
Since Data implements Deref and DerefMut, this can be used to read and mutate
the span data.
§Concurrency
In order to obtain any kind of reference to the data field,
a Mutex needs to be locked. The returned Data holds on to this lock
for as long as it lives. Therefore you must take care not to keep the returned
Data around too long or it will never relinquish the lock and you may run into
a deadlock.
pub fn get_trace_context(&self) -> TraceContext
pub fn get_trace_context(&self) -> TraceContext
Get the TransactionContext of the Span.
Note that this clones the underlying value.
pub fn get_span_id(&self) -> SpanId
pub fn get_span_id(&self) -> SpanId
Get the current span ID.
pub fn get_status(&self) -> Option<SpanStatus>
pub fn get_status(&self) -> Option<SpanStatus>
Get the status of the Span.
pub fn set_status(&self, status: SpanStatus)
pub fn set_status(&self, status: SpanStatus)
Set the status of the Span.
pub fn set_request(&self, request: Request)
pub fn set_request(&self, request: Request)
Set the HTTP request information for this Span.
pub fn iter_headers(&self) -> TraceHeadersIter ⓘ
pub fn iter_headers(&self) -> TraceHeadersIter ⓘ
Returns the headers needed for distributed tracing.
Use crate::Scope::iter_trace_propagation_headers to obtain the active
trace’s distributed tracing headers.
pub fn is_sampled(&self) -> bool
pub fn is_sampled(&self) -> bool
Get the sampling decision for this Span.
pub fn finish_with_timestamp(self, _timestamp: SystemTime)
pub fn finish_with_timestamp(self, _timestamp: SystemTime)
Finishes the Span with the provided end timestamp.
This will record the end timestamp and add the span to the transaction in which it was started.
pub fn finish(self)
pub fn finish(self)
Finishes the Span.
This will record the current timestamp as the end timestamp and add the span to the transaction in which it was started.
pub fn start_child(&self, op: &str, description: &str) -> Span
pub fn start_child(&self, op: &str, description: &str) -> Span
Starts a new child Span with the given op and description.
The span must be explicitly finished via Span::finish.
Trait Implementations§
§impl From<Span> for TransactionOrSpan
impl From<Span> for TransactionOrSpan
§fn from(span: Span) -> TransactionOrSpan
fn from(span: Span) -> TransactionOrSpan
Auto Trait Implementations§
impl Freeze for Span
impl RefUnwindSafe for Span
impl Send for Span
impl Sync for Span
impl Unpin for Span
impl UnsafeUnpin for Span
impl UnwindSafe for Span
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