Struct sentry_core::TransactionContext
source · pub struct TransactionContext { /* private fields */ }Expand description
The Transaction Context used to start a new Performance Monitoring Transaction.
The Transaction Context defines the metadata for a Performance Monitoring Transaction, and also the connection point for distributed tracing.
Implementations
sourceimpl TransactionContext
impl TransactionContext
sourcepub fn new(name: &str, op: &str) -> Self
pub fn new(name: &str, op: &str) -> Self
Creates a new Transaction Context with the given name and op.
See https://docs.sentry.io/platforms/native/enriching-events/transaction-name/
for an explanation of a Transaction’s name, and
https://develop.sentry.dev/sdk/performance/span-operations/ for conventions
around an operation’s value.
See also the TransactionContext::continue_from_headers function that
can be used for distributed tracing.
sourcepub fn continue_from_headers<'a, I: IntoIterator<Item = (&'a str, &'a str)>>(
name: &str,
op: &str,
headers: I
) -> Self
pub fn continue_from_headers<'a, I: IntoIterator<Item = (&'a str, &'a str)>>(
name: &str,
op: &str,
headers: I
) -> Self
Creates a new Transaction Context based on the distributed tracing headers.
The headers in particular need to include the sentry-trace header,
which is used to associate the transaction with a distributed trace.
sourcepub fn continue_from_span(
name: &str,
op: &str,
span: Option<TransactionOrSpan>
) -> Self
pub fn continue_from_span(
name: &str,
op: &str,
span: Option<TransactionOrSpan>
) -> Self
Creates a new Transaction Context based on an existing Span.
This should be used when an independent computation is spawned on another thread and should be connected to the calling thread via a distributed tracing transaction.