Options
All
  • Public
  • Public/Protected
  • All
Menu

Module @opentelemetry/instrumentation

Index

Type Aliases

SpanCustomizationHook<SpanCustomizationInfoType>: ((span: Span, info: SpanCustomizationInfoType) => void)

Type Parameters

  • SpanCustomizationInfoType

Type declaration

    • (span: Span, info: SpanCustomizationInfoType): void
    • SpanCustomizationHook is a common way for instrumentations to expose extension points where users can add custom behavior to a span based on info object passed to the hook at different times of the span lifecycle. This is an advanced feature, commonly used to add additional or non-spec-compliant attributes to the span, capture payloads, modify the span in some way, or carry some other side effect.

      The hook is registered with the instrumentation specific config by implementing an handler function with this signature, and if the hook is present, it will be called with the span and the event information when the event is emitted.

      When and under what conditions the hook is called and what data is passed in the info argument, is specific to each instrumentation and life-cycle event and should be documented where it is used.

      Instrumentation may define multiple hooks, for different spans, or different span life-cycle events.

      Parameters

      • span: Span
      • info: SpanCustomizationInfoType

      Returns void

Functions

  • safeExecuteInTheMiddle<T>(execute: (() => T), onFinish: ((e: undefined | Error, result: undefined | T) => void), preventThrowingError?: boolean): T
  • function to execute patched function and being able to catch errors

    Type Parameters

    • T

    Parameters

    • execute: (() => T)

      function to be executed

        • (): T
        • Returns T

    • onFinish: ((e: undefined | Error, result: undefined | T) => void)

      callback to run when execute finishes

        • (e: undefined | Error, result: undefined | T): void
        • Parameters

          • e: undefined | Error
          • result: undefined | T

          Returns void

    • Optional preventThrowingError: boolean

    Returns T

  • safeExecuteInTheMiddleAsync<T>(execute: (() => T), onFinish: ((e: undefined | Error, result: undefined | T) => void), preventThrowingError?: boolean): Promise<T>
  • Async function to execute patched function and being able to catch errors

    Type Parameters

    • T

    Parameters

    • execute: (() => T)

      function to be executed

        • (): T
        • Returns T

    • onFinish: ((e: undefined | Error, result: undefined | T) => void)

      callback to run when execute finishes

        • (e: undefined | Error, result: undefined | T): void
        • Parameters

          • e: undefined | Error
          • result: undefined | T

          Returns void

    • Optional preventThrowingError: boolean

    Returns Promise<T>

Generated using TypeDoc