SentrySamplingContext class

Context used by TracesSamplerCallback to determine if transaction is going to be sampled.

Note: This class currently supports both static (transaction-based) and streaming (span-based) modes for backwards compatibility. The dual-mode design with placeholder values and runtime checks is a temporary solution. Once the legacy transaction API is removed, this class should be simplified to only support the streaming mode with SentrySpanSamplingContextV2.

Annotations
  • @immutable

Constructors

SentrySamplingContext(SentryTransactionContext _transactionContext, SentrySpanSamplingContextV2 _spanContext, SentryTraceLifecycle _traceLifecycle, {Map<String, dynamic>? customSamplingContext})
SentrySamplingContext.forSpanV2(SentrySpanSamplingContextV2 spanContext)
Creates a sampling context for SpanV2 (streaming mode).
SentrySamplingContext.forTransaction(SentryTransactionContext transactionContext, {Map<String, dynamic>? customSamplingContext})
Creates a sampling context for legacy transactions (static mode).

Properties

customSamplingContext Map<String, dynamic>
The given sampling context
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
spanContext → SentrySpanSamplingContextV2
The Span V2 sampling context.
no setter
traceLifecycle SentryTraceLifecycle
The trace lifecycle mode for this sampling context.
no setter
transactionContext SentryTransactionContext
The Transaction context.
no setter

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited