Hierarchy

  • BaseTelemetryPlugin
    • OfflineChannel

Implements

  • IChannelControls

Constructors

Properties

_doTeardown?: ((unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState, asyncCallback?: (() => void)) => boolean | void)

Teardown / Unload hook to allow implementations to perform some additional unload operations before the BaseTelemetryPlugin finishes it's removal.

Type declaration

    • (unloadCtx?, unloadState?, asyncCallback?): boolean | void
    • Parameters

      • OptionalunloadCtx: IProcessTelemetryUnloadContext

        This is the context that should be used during unloading.

      • OptionalunloadState: ITelemetryUnloadState

        The details / state of the unload process, it holds details like whether it should be unloaded synchronously or asynchronously and the reason for the unload.

      • OptionalasyncCallback: (() => void)

        An optional callback that the plugin must call if it returns true to inform the caller that it has completed any async unload/teardown operations.

          • (): void
          • Returns void

      Returns boolean | void

      boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.

_doUpdate?: ((updateCtx?: IProcessTelemetryUpdateContext, updateState?: ITelemetryUpdateState, asyncCallback?: (() => void)) => boolean | void)

Extension hook to allow implementations to perform some additional update operations before the BaseTelemetryPlugin finishes it's removal

Type declaration

    • (updateCtx?, updateState?, asyncCallback?): boolean | void
    • Parameters

      • OptionalupdateCtx: IProcessTelemetryUpdateContext

        This is the context that should be used during updating.

      • OptionalupdateState: ITelemetryUpdateState

        The details / state of the update process, it holds details like the current and previous configuration.

      • OptionalasyncCallback: (() => void)

        An optional callback that the plugin must call if it returns true to inform the caller that it has completed any async update operations.

          • (): void
          • Returns void

      Returns boolean | void

      boolean - true if the plugin has or will call asyncCallback, this allows the plugin to perform any asynchronous operations.

_getTelCtx: ((currentCtx?: IProcessTelemetryContext) => IProcessTelemetryContext)

Helper to return the current IProcessTelemetryContext, if the passed argument exists this just returns that value (helps with minification for callers), otherwise it will return the configured context or a temporary one.

Type declaration

    • (currentCtx?): IProcessTelemetryContext
    • Parameters

      • OptionalcurrentCtx: IProcessTelemetryContext

        [Optional] The current execution context

      Returns IProcessTelemetryContext

_unloadHooks: IUnloadHookContainer

Exposes the underlying unload hook container instance for this extension to allow it to be passed down to any sub components of the class. This should NEVER be exposed or called publically as it's scope is for internal use by BaseTelemetryPlugin and any derived class (which is why it's scoped as protected)

core: IAppInsightsCore<IConfiguration>

Holds the core instance that was used during initialization

diagLog: ((itemCtx?: IProcessTelemetryContext) => IDiagnosticLogger)

Returns the current diagnostic logger that can be used to log issues, if no logger is currently assigned a new default one will be created and returned.

id: string
identifier: string = DefaultOfflineIdentifier
isInitialized: (() => boolean)

Returns whether the plugin has been initialized

priority: number = 1000
processNext: ((env: ITelemetryItem, itemCtx: IProcessTelemetryContext) => void)

Call back for telemetry processing before it it is sent

Type declaration

    • (env, itemCtx): void
    • Parameters

      • env: ITelemetryItem

        This is the current event being reported

      • itemCtx: IProcessTelemetryContext

        This is the context for the current request, ITelemetryPlugin instances can optionally use this to access the current core instance or define / pass additional information to later plugins (vs appending items to the telemetry item)

      Returns void

setInitialized: ((isInitialized: boolean) => void)

Internal helper to allow setting of the internal initialized setting for inherited instances and unit testing

setNextPlugin?: ((next: ITelemetryPluginChain | ITelemetryPlugin) => void)

Set next extension for telemetry processing, this is now optional as plugins should use the processNext() function of the passed IProcessTelemetryContext instead. It is being kept for now for backward compatibility only.

  • Use processNext() function of the passed IProcessTelemetryContext instead
version: string = version

Methods

  • Add this hook so that it is automatically removed during unloading

    Parameters

    • hooks:
          | IUnloadHook
          | IUnloadHook[]
          | Iterator<IUnloadHook, any, undefined>
          | ILegacyUnloadHook
          | ILegacyUnloadHook[]
          | Iterator<ILegacyUnloadHook, any, undefined>

      The single hook or an array of IInstrumentHook objects

    Returns void

  • Add an unload handler that will be called when the SDK is being unloaded

    Parameters

    • handler: UnloadHandler

      the handler

    Returns void

  • No op

    Parameters

    • sync: boolean
    • OptionalcallBack: ((flushComplete?: boolean) => void)
        • (flushComplete?): void
        • Parameters

          • OptionalflushComplete: boolean

          Returns void

    • OptionalsendReason: SendRequestReason

    Returns boolean | void | IPromise<boolean>

  • Get offline listener

    Returns any

    offline listener

  • The function does the initial set up. It adds a notification listener to determine which events to remove.

    Parameters

    • coreConfig: IConfiguration & IConfig

      The core configuration.

    • core: IAppInsightsCore<IConfiguration>

      The AppInsights core.

    • extensions: IPlugin[]

      An array of all the plugins being used.

    • OptionalpluginChain: ITelemetryPluginChain

    Returns void

  • Flush the batched events synchronously (if possible -- based on configuration). Will not flush if the Send has been paused.

    Returns void

  • Pauses the adding of new events to the plugin. Also calls pause on the next plugin.

    Returns void

  • Process an event to add it to the local storage and then pass it to the next plugin.

    Parameters

    • evt: ITelemetryItem
    • OptionalitemCtx: IProcessTelemetryContext

      This is the context for the current request, ITelemetryPlugin instances can optionally use this to access the current core instance or define / pass additional information to later plugins (vs appending items to the telemetry item)

    Returns void

  • Resumes the adding of new events to the plugin. Also calls resume on the next plugin. Adds all events in storage to the next plugin.

    Returns void

  • Tear down the plugin and remove any hooked value, the plugin should be removed so that it is no longer initialized and therefore could be re-initialized after being torn down. The plugin should ensure that once this has been called any further processTelemetry calls are ignored and it just calls the processNext() with the provided context.

    Parameters

    • OptionalunloadCtx: IProcessTelemetryUnloadContext

      This is the context that should be used during unloading.

    • OptionalunloadState: ITelemetryUnloadState

      The details / state of the unload process, it holds details like whether it should be unloaded synchronously or asynchronously and the reason for the unload.

    Returns boolean | void

    boolean - true if the plugin has or will call processNext(), this for backward compatibility as previously teardown was synchronous and returned nothing.

  • The the plugin should re-evaluate configuration and update any cached configuration settings.

    Parameters

    • updateCtx: IProcessTelemetryUpdateContext

      This is the context that should be used during updating.

    • updateState: ITelemetryUpdateState

      The details / state of the update process, it holds details like the current and previous configuration.

    Returns boolean | void

    boolean - true if the plugin has or will call updateCtx.processNext(), this allows the plugin to perform any asynchronous operations.