The current context for the current call to processTelemetry(), used to support sharing the same plugin instance between multiple AppInsights instances

interface IProcessTelemetryContext {
    core: (() => IAppInsightsCore<IConfiguration>);
    createNew: ((plugins?: ITelemetryPluginChain | IPlugin[], startAt?: IPlugin) => IProcessTelemetryContext);
    diagLog: (() => IDiagnosticLogger);
    getCfg: (() => IConfiguration);
    getConfig: ((identifier: string, field: string, defaultValue?:
        | string
        | number
        | boolean
        | Function
        | string[]
        | RegExp[]) =>
        | string
        | number
        | boolean
        | Function
        | string[]
        | RegExp[]);
    getExtCfg: (<T>(identifier: string, defaultValue?: IConfigDefaults<T, IConfiguration>) => T);
    getNext: (() => ITelemetryPluginChain);
    hasNext: (() => boolean);
    iterate: (<T>(callback: ((plugin: T) => void)) => void);
    onComplete: ((onComplete: (() => void), that?: any, ...args: any[]) => void);
    processNext: ((env: ITelemetryItem) => boolean | void);
    setNext: ((nextCtx: ITelemetryPluginChain) => void);
}

Hierarchy (view full)

Implemented by

Properties

The current core instance for the request

createNew: ((plugins?: ITelemetryPluginChain | IPlugin[], startAt?: IPlugin) => IProcessTelemetryContext)

Create a new context using the core and config from the current instance, returns a new instance of the same type

Type declaration

diagLog: (() => IDiagnosticLogger)

THe current diagnostic logger for the request

getCfg: (() => IConfiguration)

Gets the current core config instance

getConfig: ((identifier: string, field: string, defaultValue?:
    | string
    | number
    | boolean
    | Function
    | string[]
    | RegExp[]) =>
    | string
    | number
    | boolean
    | Function
    | string[]
    | RegExp[])

Gets the named config from either the named identifier extension or core config if neither exist then the default value is returned

Type declaration

    • (identifier, field, defaultValue?):
          | string
          | number
          | boolean
          | Function
          | string[]
          | RegExp[]
    • Parameters

      • identifier: string

        The named extension identifier

      • field: string

        The config field name

      • OptionaldefaultValue:
            | string
            | number
            | boolean
            | Function
            | string[]
            | RegExp[]

        The default value to return if no defined config exists

      Returns
          | string
          | number
          | boolean
          | Function
          | string[]
          | RegExp[]

getExtCfg: (<T>(identifier: string, defaultValue?: IConfigDefaults<T, IConfiguration>) => T)

Gets the named extension config

getNext: (() => ITelemetryPluginChain)

Returns the next configured plugin proxy

hasNext: (() => boolean)

Helper to allow plugins to check and possibly shortcut executing code only required if there is a nextPlugin

iterate: (<T>(callback: ((plugin: T) => void)) => void)

Synchronously iterate over the context chain running the callback for each plugin, once every plugin has been executed via the callback, any associated onComplete will be called.

Type declaration

    • <T>(callback): void
    • Type Parameters

      Parameters

      • callback: ((plugin: T) => void)

        The function call for each plugin in the context chain

          • (plugin): void
          • Parameters

            • plugin: T

            Returns void

      Returns void

onComplete: ((onComplete: (() => void), that?: any, ...args: any[]) => void)

Set the function to call when the current chain has executed all processNext or unloadNext items.

Type declaration

    • (onComplete, that?, ...args): void
    • Parameters

      • onComplete: (() => void)

        The onComplete to call

          • (): void
          • Returns void

      • Optionalthat: any

        The "this" value to use for the onComplete call, if not provided or undefined defaults to the current context

      • Rest...args: any[]

        Any additional arguments to pass to the onComplete function

      Returns void

processNext: ((env: ITelemetryItem) => boolean | void)

Call back for telemetry processing before it it is sent

Type declaration

    • (env): boolean | void
    • Parameters

      Returns boolean | void

      boolean (true) if there is no more plugins to process otherwise false or undefined (void)

setNext: ((nextCtx: ITelemetryPluginChain) => void)

Helper to set the next plugin proxy