Options
All
  • Public
  • Public/Protected
  • All
Menu

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.

Spans are created by the Tracer.startSpan method.

since

1.0.0

Hierarchy

  • Span

Index

Methods

  • Adds a single link to the span.

    Links added after the creation will not affect the sampling decision. It is preferred span links be added at span creation.

    Parameters

    • link: Link

      the link to add.

    Returns Span

  • Adds multiple links to the span.

    Links added after the creation will not affect the sampling decision. It is preferred span links be added at span creation.

    Parameters

    • links: Link[]

      the links to add.

    Returns Span

  • 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

  • isRecording(): 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.

  • Sets an attribute to the span.

    Sets a single Attribute with the key and value passed as arguments.

    Parameters

    • key: string

      the key for this attribute.

    • value: AttributeValue

      the value for this attribute. Setting a value null or undefined is invalid and will result in undefined behavior.

    Returns Span

  • Sets attributes to the span.

    Parameters

    • attributes: Attributes

      the attributes that will be added. null or undefined attribute values are invalid and will result in undefined behavior.

    Returns Span

  • Returns the SpanContext object associated with this Span.

    Get an immutable, serializable identifier for this span that can be used to create new child spans. Returned SpanContext is usable even after the span ends.

    Returns SpanContext

    the SpanContext object associated with this Span.

  • updateName(name: string): Span
  • Updates the Span name.

    This will override the name provided via Tracer.startSpan.

    Upon this update, any sampling behavior based on Span name will depend on the implementation.

    Parameters

    • name: string

      the Span name.

    Returns Span

Generated using TypeDoc