Singleton object which represents the entry point to the OpenTelemetry Context API

1.0.0

Methods

  • Bind a context to a target function or event emitter

    Type Parameters

    • T

    Parameters

    • context: @opentelemetry/api.Context

      context to bind to the event emitter or function. Defaults to the currently active context

    • target: T

      function or event emitter to bind

    Returns T

  • Disable and remove the global context manager

    Returns void

  • Execute a function with an active context

    Type Parameters

    • A extends unknown[]
    • F extends (...args: A) => ReturnType<F>

    Parameters

    • context: @opentelemetry/api.Context

      context to be active during function execution

    • fn: F

      function to execute in a context

    • OptionalthisArg: ThisParameterType<F>

      optional receiver to be used for calling fn

    • ...args: A

      optional arguments forwarded to fn

    Returns ReturnType<F>