Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface RootSpan

Represents the root span within a trace.

Hierarchy

Implemented by

Index

Properties

type

type: SpanType

The current span type. See SpanType for more information.

Methods

addLabel

  • addLabel(key: string, value: any): void
  • Adds a key-value pair as a label to the trace span. The value will be converted to a string if it is not already, and both the key and value may be truncated according to the user's configuration.

    Parameters

    • key: string

      The label's key.

    • value: any

      The label's value.

    Returns void

createChildSpan

  • Creates and starts a child span under this root span. If the root span is a real span (type = ROOT), the child span will be as well (type = CHILD). Otherwise, if the root span's type is UNTRACED or UNCORRELATED, the child span will be of the same type.

    Parameters

    • Optional options: SpanOptions

      Options for creating the child span.

    Returns Span

    A new Span object.

endSpan

  • endSpan(timestamp?: Date): void
  • Ends the span. This method should only be called once.

    Parameters

    • Optional timestamp: Date

      A custom span end time; defaults to the time when endSpan was called if not provided.

    Returns void

getTraceContext

  • getTraceContext(): string
  • Gets the current trace context serialized as a string, or an empty string if it can't be generated.

    Returns string

    The stringified trace context.

Generated using TypeDoc