dd-trace
    Preparing search index...

    Interface Scope

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

    interface Scope {
        activate<T>(span: Span, fn: (...args: any[]) => T): T;
        active(): null | Span;
        bind<T extends (...args: any[]) => void>(fn: T, span?: null | Span): T;
        bind<V, T extends (...args: any[]) => V>(fn: T, span?: null | Span): T;
        bind<T>(fn: Promise<T>, span?: null | Span): Promise<T>;
    }
    Index

    Methods

    • Activate a span in the scope of a function.

      Type Parameters

      • T

      Parameters

      • span: Span

        The span to activate.

      • fn: (...args: any[]) => T

        Function that will have the span activated on its scope.

      Returns T

      The return value of the provided function.

    • Get the current active span or null if there is none.

      Returns null | Span

      The active span.

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

      Type Parameters

      • T extends (...args: any[]) => void

      Parameters

      • fn: T

        Target that will have the span activated on its scope.

      • Optionalspan: null | Span

        The span to activate.

      Returns T

      The bound target.

    • Type Parameters

      • V
      • T extends (...args: any[]) => V

      Parameters

      • fn: T
      • Optionalspan: null | Span

      Returns T

    • Type Parameters

      • T

      Parameters

      • fn: Promise<T>
      • Optionalspan: null | Span

      Returns Promise<T>