Interface Scope

The Datadog Scope Manager. This is used for context propagation.

interface Scope {
    activate<T>(span, fn): T;
    active(): null | export=.Span;
    bind<T>(fn, span?): T;
    bind<V, T>(fn, span?): T;
    bind<T>(fn, span?): Promise<T>;
}

Methods

  • Activate a span in the scope of a function.

    Type Parameters

    • T

    Parameters

    • span: export=.Span

      The span to activate.

    • fn: ((...args) => T)

      Function that will have the span activated on its scope.

        • (...args): T
        • Parameters

          • Rest ...args: any[]

          Returns T

    Returns T

    The return value of the provided function.

  • Binds a target to the provided span, or the active span if omitted.

    Type Parameters

    • T extends ((...args) => void)

    Parameters

    • fn: T

      Target that will have the span activated on its scope.

    • Optional span: null | export=.Span

      The span to activate.

    Returns T

    The bound target.

  • Type Parameters

    • V
    • T extends ((...args) => V)

    Parameters

    Returns T

  • Type Parameters

    • T

    Parameters

    Returns Promise<T>