SentryTransactionContext.fromSentryTrace constructor

SentryTransactionContext.fromSentryTrace(
  1. String name,
  2. String operation,
  3. SentryTraceHeader traceHeader, {
  4. SentryTransactionNameSource? transactionNameSource,
  5. SentryBaggage? baggage,
})

Implementation

factory SentryTransactionContext.fromSentryTrace(
  String name,
  String operation,
  SentryTraceHeader traceHeader, {
  SentryTransactionNameSource? transactionNameSource,
  SentryBaggage? baggage,
}) {
  final sampleRate = baggage?.getSampleRate();
  return SentryTransactionContext(
    name,
    operation,
    traceId: traceHeader.traceId,
    parentSpanId: traceHeader.spanId,
    parentSamplingDecision: traceHeader.sampled != null
        ? SentryTracesSamplingDecision(
            traceHeader.sampled!,
            sampleRate: sampleRate,
          )
        : null,
    transactionNameSource:
        transactionNameSource ?? SentryTransactionNameSource.custom,
    origin: SentryTraceOrigins.manual,
  );
}