Transaction "Class", inherits Span only has setName

interface Transaction {
    attributes: SpanAttributes;
    data: { [key: string]: any };
    description?: string;
    endTimestamp?: number;
    exclusiveTime?: number;
    instrumenter: Instrumenter;
    measurements?: Measurements;
    metadata: TransactionMetadata;
    name: string;
    op?: string;
    origin?: SpanOrigin;
    parentSampled?: boolean;
    parentSpanId?: string;
    sampled?: boolean;
    spanId: string;
    startTimestamp: number;
    status?: string;
    tags: { [key: string]: Primitive };
    traceId: string;
    transaction?: Transaction;
    trimEnd?: boolean;
    end(endTimestamp?: SpanTimeInput): void;
    finish(endTimestamp?: number): void;
    getDynamicSamplingContext(): Partial<DynamicSamplingContext>;
    getProfileId(): undefined | string;
    getTraceContext(): TraceContext;
    isRecording(): boolean;
    isSuccess(): boolean;
    setAttribute(key: string, value: undefined | SpanAttributeValue): void;
    setAttributes(attributes: SpanAttributes): void;
    setContext(key: string, context: Context): void;
    setData(key: string, value: any): this;
    setHttpStatus(httpStatus: number): this;
    setMeasurement(name: string, value: number, unit: MeasurementUnit): void;
    setMetadata(newMetadata: Partial<TransactionMetadata>): void;
    setName(name: string, source?: TransactionSource): void;
    setStatus(status: string): this;
    setTag(key: string, value: Primitive): this;
    spanContext(): SpanContextData;
    startChild(
        spanContext?: Pick<
            SpanContext,
            | "instrumenter"
            | "name"
            | "status"
            | "op"
            | "origin"
            | "description"
            | "spanId"
            | "tags"
            | "data"
            | "attributes"
            | "startTimestamp"
            | "endTimestamp"
            | "exclusiveTime"
            | "measurements",
        >,
    ): Span;
    toContext(): TransactionContext;
    toJSON(): SpanJSON;
    toTraceparent(): string;
    updateName(name: string): this;
    updateWithContext(transactionContext: TransactionContext): this;
}

Hierarchy

  • TransactionContext
  • Omit<Span, "setName" | "name">
    • Transaction

Properties

attributes: SpanAttributes

Attributes for the transaction.

Use getSpanAttributes(transaction) instead.

data: { [key: string]: any }

Data for the transaction.

Use getSpanAttributes(transaction) instead.

description?: string

Description of the Span.

Use name instead.

endTimestamp?: number

Timestamp in seconds (epoch time) indicating when the span ended.

exclusiveTime?: number

Exclusive time in milliseconds.

instrumenter: Instrumenter

The instrumenter that created this transaction.

This field will be removed in v8.

measurements?: Measurements

Measurements of the Span.

metadata: TransactionMetadata

Metadata about the transaction.

Use attributes or store data on the scope instead.

name: string

Human-readable identifier for the transaction.

Use spanToJSON(span).description instead.

op?: string

Operation of the Span.

origin?: SpanOrigin

The origin of the span, giving context about what created the span.

parentSampled?: boolean

If this transaction has a parent, the parent's sampling decision

parentSpanId?: string

Parent Span ID

sampled?: boolean

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

Use spanIsSampled(transaction) instead.

spanId: string

The ID of the transaction.

Use spanContext().spanId instead.

startTimestamp: number
status?: string

Completion status of the Span. See: {@sentry/tracing SpanStatus} for possible values

tags: { [key: string]: Primitive }

Tags for the transaction.

Use getSpanAttributes(transaction) instead.

traceId: string

The ID of the trace.

Use spanContext().traceId instead.

transaction?: Transaction

The transaction containing this span

Use top level Sentry.getRootSpan() instead

trimEnd?: boolean

If true, sets the end timestamp of the transaction to the highest timestamp of child spans, trimming the duration of the transaction. This is useful to discard extra time in the transaction that is not accounted for in child spans, like what happens in the idle transaction Tracing integration, where we finish the transaction after a given "idle time" and we don't want this "idle time" to be part of the transaction.

Methods

  • End the current span.

    Parameters

    • OptionalendTimestamp: SpanTimeInput

    Returns void

  • Sets the finish timestamp on the current span.

    Parameters

    • OptionalendTimestamp: number

      Takes an endTimestamp if the end should not be the time when you call this function.

    Returns void

    Use .end() instead.

  • Return the current Dynamic Sampling Context of this transaction

    Returns Partial<DynamicSamplingContext>

    Use top-level getDynamicSamplingContextFromSpan instead.

  • Get the profile id from the transaction

    Returns undefined | string

    Use toJSON() or access the fields directly instead.

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

    Returns TraceContext

    Use spanToTraceContext() util function instead.

  • If this is span is actually recording data. This will return false if tracing is disabled, this span was not sampled or if the span is already finished.

    Returns boolean

  • Determines whether span was successful (HTTP200)

    Returns boolean

    Use spanToJSON(span).status === 'ok' instead.

  • Set a single attribute on the span. Set it to undefined to remove the attribute.

    Parameters

    • key: string
    • value: undefined | SpanAttributeValue

    Returns void

  • Set multiple attributes on the span. Any attribute set to undefined will be removed.

    Parameters

    • attributes: SpanAttributes

    Returns void

  • Set the context of a transaction event.

    Parameters

    • key: string
    • context: Context

    Returns void

    Use either .setAttribute(), or set the context on the scope before creating the transaction.

  • Sets the data attribute on the current span

    Parameters

    • key: string

      Data key

    • value: any

      Data value

    Returns this

    Use setAttribute() instead.

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

    Parameters

    • httpStatus: number

      http code used to set the status

    Returns this

    Use top-level setHttpStatus() instead.

  • Set observed measurement for this transaction.

    Parameters

    • name: string

      Name of the measurement

    • value: number

      Value of the measurement

    • unit: MeasurementUnit

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

    Returns void

    Use top-level setMeasurement() instead.

  • Set metadata for this transaction.

    Parameters

    • newMetadata: Partial<TransactionMetadata>

    Returns void

    Use attributes or store data on the scope instead.

  • Set the name of the transaction

    Parameters

    • name: string
    • Optionalsource: TransactionSource

    Returns void

    Use .updateName() and .setAttribute() instead.

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

    Parameters

    • status: string

      http code used to set the status

    Returns this

  • 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 this

    Use setAttribute() instead.

  • Get context data for this span. This includes the spanId & the traceId.

    Returns SpanContextData

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

    Parameters

    • OptionalspanContext: Pick<
          SpanContext,
          | "instrumenter"
          | "name"
          | "status"
          | "op"
          | "origin"
          | "description"
          | "spanId"
          | "tags"
          | "data"
          | "attributes"
          | "startTimestamp"
          | "endTimestamp"
          | "exclusiveTime"
          | "measurements",
      >

    Returns Span

    Use startSpan(), startSpanManual() or startInactiveSpan() instead.

  • Returns the current transaction properties as a TransactionContext.

    Returns TransactionContext

    Use toJSON() or access the fields directly instead.

  • Convert the object to JSON.

    Returns SpanJSON

    Use spanToJSON(span) instead.

  • Return a traceparent compatible header string.

    Returns string

    Use spanToTraceHeader() instead.

  • Update the name of the span.

    Parameters

    • name: string

    Returns this

  • Updates the current transaction with a new TransactionContext.

    Parameters

    • transactionContext: TransactionContext

    Returns this

    Update the fields directly instead.