Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Tracer

Tracer provides an interface for creating Spans and propagating context in-process.

Users may choose to use manual or automatic Context propagation. Because of that this class offers APIs to facilitate both usages.

Hierarchy

  • Tracer

Implemented by

Index

Methods

bind

  • bind<T>(target: T, context?: Span): T
  • Bind a span as the target's context or propagate the current one.

    Type parameters

    • T

    Parameters

    • target: T

      Any object to which a context need to be set

    • Optional context: Span

    Returns T

getCurrentSpan

  • getCurrentSpan(): Span | undefined
  • Returns the current Span from the current context if available.

    If there is no Span associated with the current context, null is returned.

    Returns Span | undefined

    Span The currently active Span

startSpan

withSpan

  • withSpan<T>(span: Span, fn: T): ReturnType<T>
  • Executes the function given by fn within the context provided by Span

    example

    tracer.withSpan(span, function() { ... });

    Type parameters

    • T: function

    Parameters

    • span: Span

      The span that provides the context

    • fn: T

      The function to be executed inside the provided context

    Returns ReturnType<T>