An IdleTransaction is a transaction that automatically finishes. It does this by tracking child spans as activities. You can have multiple IdleTransactions active, but if the onScope option is specified, the idle transaction will put itself on the scope on creation.

Hierarchy

Properties

_hub: Hub

The reference to the current hub.

data: {
    [key: string]: any;
}

Data of the Span.

Type declaration

  • [key: string]: any
description?: string

Description of the Span.

endTimestamp?: number

Timestamp in seconds when the span ended.

instrumenter: Instrumenter

The instrumenter that created this span.

op?: string

Operation of the Span.

parentSpanId?: string

Parent Span ID

sampled?: boolean

Was this span chosen to be sent as part of the sample?

spanId: string

Span ID

spanRecorder?: SpanRecorder

List of spans that were finalized

startTimestamp: number

Timestamp in seconds when the span was created.

status?: string

Internal keeper of the status

tags: {
    [key: string]: Primitive;
}

Tags of the Span.

Type declaration

  • [key: string]: Primitive
traceId: string

Trace ID

transaction?: Transaction

The transaction containing this span

Accessors

  • get name(): string
  • Getter for name property

    Returns string

  • set name(newName): void
  • Setter for name property, which also sets source as custom

    Parameters

    • newName: string

    Returns void

Methods

  • Cancels the existing idle timeout, if there is one.

    Parameters

    • Optional endTimestamp: number
    • Optional __namedParameters: {
          restartOnChildSpanChange?: boolean;
      }
      • Optional restartOnChildSpanChange?: boolean

    Returns void

  • Parameters

    • Optional endTimestamp: number

    Returns undefined | string

  • Return the current Dynamic Sampling Context of this transaction

    Returns Readonly<Partial<DynamicSamplingContext>>

  • Convert the object to JSON for w. spans array info only

    Returns TraceContext

  • Attaches SpanRecorder to the span itself

    Parameters

    • Optional maxlen: number

      maximum number of spans that can be recorded

    Returns void

  • Determines whether span was successful (HTTP200)

    Returns boolean

  • Register a callback function that gets excecuted before the transaction finishes. Useful for cleanup or if you want to add any additional spans based on current context.

    This is exposed because users have no other way of running something before an idle transaction finishes.

    Parameters

    • callback: BeforeFinishCallback

    Returns void

  • Set the context of a transaction event

    Parameters

    • key: string
    • context: null | Context

    Returns void

  • Sets the data attribute on the current span

    Parameters

    • key: string

      Data key

    • value: any

      Data value

    Returns IdleTransaction

  • Internal

    Temporary method used to externally set the transaction's finishReason

    ** WARNING** This is for the purpose of experimentation only and will be removed in the near future, do not use!

    Parameters

    • reason: string

    Returns void

  • Sets the status attribute on the current span based on the http code

    Parameters

    • httpStatus: number

      http code used to set the status

    Returns IdleTransaction

  • Internal

    Override the current hub with a new one. Used if you want another hub to finish the transaction.

    Parameters

    Returns void

  • Set observed measurement for this transaction.

    Parameters

    • name: string

      Name of the measurement

    • value: number

      Value of the measurement

    • Optional unit: MeasurementUnit

      Unit of the measurement. (Defaults to an empty string)

    Returns void

  • Parameters

    • newMetadata: Partial<TransactionMetadata>

    Returns void

    Inherit Doc

  • JSDoc

    Parameters

    Returns void

  • Sets the status attribute on the current span See: {@sentry/tracing SpanStatus} for possible values

    Parameters

    • value: SpanStatusType

      http code used to set the status

    Returns IdleTransaction

  • Sets the tag attribute on the current span.

    Can also be used to unset a tag, by passing undefined.

    Parameters

    • key: string

      Tag key

    • value: Primitive

      Tag value

    Returns IdleTransaction

  • Creates a new Span while setting the current Span.id as parentSpanId. Also the sampled decision will be inherited.

    Parameters

    • Optional spanContext: Pick<SpanContext, "description" | "op" | "status" | "spanId" | "tags" | "data" | "startTimestamp" | "endTimestamp" | "instrumenter">

    Returns Span

  • Convert the object to JSON

    Returns {
        data?: {
            [key: string]: any;
        };
        description?: string;
        op?: string;
        parent_span_id?: string;
        span_id: string;
        start_timestamp: number;
        status?: string;
        tags?: {
            [key: string]: Primitive;
        };
        timestamp?: number;
        trace_id: string;
    }

    • Optional data?: {
          [key: string]: any;
      }
      • [key: string]: any
    • Optional description?: string
    • Optional op?: string
    • Optional parent_span_id?: string
    • span_id: string
    • start_timestamp: number
    • Optional status?: string
    • Optional tags?: {
          [key: string]: Primitive;
      }
      • [key: string]: Primitive
    • Optional timestamp?: number
    • trace_id: string
  • Return a traceparent compatible header string

    Returns string

Generated using TypeDoc