Package io.sentry

Class TransactionContext

java.lang.Object
io.sentry.SpanContext
io.sentry.TransactionContext
All Implemented Interfaces:
JsonSerializable, JsonUnknown

public final class TransactionContext extends SpanContext
  • Constructor Details

    • TransactionContext

      public TransactionContext(@NotNull @NotNull String name, @NotNull @NotNull String operation)
    • TransactionContext

      @Internal public TransactionContext(@NotNull @NotNull String name, @NotNull @NotNull TransactionNameSource transactionNameSource, @NotNull @NotNull String operation)
    • TransactionContext

      public TransactionContext(@NotNull @NotNull String name, @NotNull @NotNull String operation, @Nullable @Nullable TracesSamplingDecision samplingDecision)
      Creates TransactionContext with explicit sampling decision.
      Parameters:
      name - - transaction name
      operation - - operation
      samplingDecision - - sampling decision
    • TransactionContext

      @Internal public TransactionContext(@NotNull @NotNull String name, @NotNull @NotNull TransactionNameSource transactionNameSource, @NotNull @NotNull String operation, @Nullable @Nullable TracesSamplingDecision samplingDecision)
      Creates TransactionContext with explicit sampling decision and name source.
      Parameters:
      name - - transaction name
      operation - - operation
      samplingDecision - - sampling decision
    • TransactionContext

      @Internal public TransactionContext(@NotNull @NotNull SentryId traceId, @NotNull @NotNull SpanId spanId, @Nullable @Nullable SpanId parentSpanId, @Nullable @Nullable TracesSamplingDecision parentSamplingDecision, @Nullable @Nullable Baggage baggage)
  • Method Details

    • fromSentryTrace

      @Deprecated @NotNull public static @NotNull TransactionContext fromSentryTrace(@NotNull @NotNull String name, @NotNull @NotNull String operation, @NotNull @NotNull SentryTraceHeader sentryTrace)
      Deprecated.
      use Sentry.continueTrace(String, List) and setters for name and operation here instead.
      Creates TransactionContext from sentry-trace header.
      Parameters:
      name - - the transaction name
      operation - - the operation
      sentryTrace - - the sentry-trace header
      Returns:
      the transaction contexts
    • fromPropagationContext

      @Internal public static TransactionContext fromPropagationContext(@NotNull @NotNull PropagationContext propagationContext)
    • getName

      @NotNull public @NotNull String getName()
    • getParentSampled

      @Nullable public @Nullable Boolean getParentSampled()
    • getParentSamplingDecision

      @Nullable public @Nullable TracesSamplingDecision getParentSamplingDecision()
    • getBaggage

      @Nullable public @Nullable Baggage getBaggage()
    • setParentSampled

      public void setParentSampled(@Nullable @Nullable Boolean parentSampled)
    • setParentSampled

      public void setParentSampled(@Nullable @Nullable Boolean parentSampled, @Nullable @Nullable Boolean parentProfileSampled)
    • getTransactionNameSource

      @NotNull public @NotNull TransactionNameSource getTransactionNameSource()
    • getInstrumenter

      @NotNull public @NotNull Instrumenter getInstrumenter()
    • setInstrumenter

      public void setInstrumenter(@NotNull @NotNull Instrumenter instrumenter)
    • setName

      public void setName(@NotNull @NotNull String name)
    • setTransactionNameSource

      public void setTransactionNameSource(@NotNull @NotNull TransactionNameSource transactionNameSource)
    • setForNextAppStart

      @Internal public void setForNextAppStart(boolean forNextAppStart)
    • isForNextAppStart

      public boolean isForNextAppStart()
      Whether this TransactionContext evaluates for the next app start. If this is true, it gets called only once when the SDK initializes. This is set only if SentryOptions.isEnableAppStartProfiling() is true.
      Returns:
      True if this TransactionContext will be used for the next app start.