Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Span

Package version

An interface that represents a span. A span represents a single operation within a trace. Examples of span might include remote procedure calls or a in-process function calls to sub-components. A Trace has a single, top-level "root" Span that in turn may have zero or more child Spans, which in turn may have children.

Hierarchy

  • Span

Implemented by

Index

Methods

addEvent

  • addEvent(name: string, attributes?: Attributes): this
  • Adds an event to the Span.

    Parameters

    • name: string

      the name of the event.

    • Optional attributes: Attributes

    Returns this

addLink

  • Adds a link to the Span.

    Parameters

    Returns this

context

  • Returns the SpanContext object associated with this Span.

    Returns SpanContext

    the SpanContext object associated with this Span.

end

  • Marks the end of Span execution.

    Call to End of a Span MUST not have any effects on child spans. Those may still be running and can be ended later.

    Do not return this. The Span generally should not be used after it is ended so chaining is not desired in this context.

    Parameters

    Returns void

isRecordingEvents

  • isRecordingEvents(): boolean
  • Returns the flag whether this span will be recorded.

    Returns boolean

    true if this Span is active and recording information like events with the AddEvent operation and attributes using setAttributes.

setAttribute

  • setAttribute(key: string, value: unknown): this
  • Sets an attribute to the span.

    Parameters

    • key: string

      the key for this attribute.

    • value: unknown

      the value for this attribute.

    Returns this

setAttributes

  • Sets attributes to the span.

    Parameters

    • attributes: Attributes

      the attributes that will be added.

    Returns this

setStatus

  • setStatus(status: Status): this
  • Sets a status to the span. If used, this will override the default Span status. Default is CanonicalCode.OK.

    Parameters

    • status: Status

      the Status to set.

    Returns this

updateName

  • updateName(name: string): this

Generated using TypeDoc