Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TestTracer

Package version

A mock tracer useful for testing

Hierarchy

Implements

  • Tracer

Index

Methods

bind

  • bind<T>(target: T, _span?: Span): T
  • Bind a Span as the target's scope

    Type parameters

    • T

    Parameters

    • target: T

      An object to bind the scope.

    • Optional _span: Span

      A specific Span to use. Otherwise, use the current one.

    Returns T

getActiveSpans

  • Returns all Spans where end() has not been called

    Returns TestSpan[]

getBinaryFormat

  • Returns the BinaryFormat interface for serializing/deserializing Spans.

    Returns BinaryFormat

getCurrentSpan

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

    Returns Span

getHttpTextFormat

  • Returns the HttpTextFormat interface for injecting/extracting Spans.

    Returns HttpTextFormat

getKnownSpans

  • Returns all Spans this Tracer knows about

    Returns TestSpan[]

getRootSpans

  • Returns all Spans that were created without a parent

    Returns TestSpan[]

getSpanGraph

  • Return all Spans for a particular trace, grouped by their parent Span in a tree-like structure

    Parameters

    • traceId: string

      The traceId to return the graph for

    Returns SpanGraph

recordSpanData

  • recordSpanData(_span: Span): void
  • Send a pre-populated Span object to the exporter.

    Parameters

    • _span: Span

      The span to pass along.

    Returns void

startSpan

  • Starts a new Span.

    Parameters

    • name: string

      The name of the span.

    • Optional options: SpanOptions

      The SpanOptions used during Span creation.

    Returns TestSpan

withSpan

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

    Type parameters

    • T: function

    Parameters

    • _span: Span

      The span that provides the context.

    • fn: T

      The function to be executed.

    Returns ReturnType<T>

Generated using TypeDoc