Interface for the Ajax Monitor Plugin that extends IPlugin and includes ajax specific functionality. This interface is used for proper typing when retrieving the plugin via getPlugin().

interface IAjaxMonitorPlugin {
    addDependencyListener(dependencyListener: DependencyListenerFunction): IDependencyListenerHandler;
    core?: IAppInsightsCore<IConfiguration>;
    identifier: string;
    includeCorrelationHeaders: ((ajaxData: ajaxRecord, input?: string | Request, init?: RequestInit, xhr?: XMLHttpRequestInstrumented) => any);
    initialize: ((config: IConfiguration, core: IAppInsightsCore<IConfiguration>, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain) => void);
    isInitialized?: (() => boolean);
    resetAjaxAttempts(): void;
    teardown?: ((unloadCtx: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) => boolean | void);
    trackDependencyData(dependency: IDependencyTelemetry): void;
    version?: string;
}

Hierarchy (view full)

Implemented by

Properties

core?: IAppInsightsCore<IConfiguration>

The App Insights core to use for backward compatibility. Therefore the interface will be able to access the core without needing to cast to "any". [optional] any 3rd party plugins which are already implementing this interface don't fail to compile.

identifier: string

Extension name

includeCorrelationHeaders: ((ajaxData: ajaxRecord, input?: string | Request, init?: RequestInit, xhr?: XMLHttpRequestInstrumented) => any)
initialize: ((config: IConfiguration, core: IAppInsightsCore<IConfiguration>, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain) => void)

Initialize plugin loaded by SDK

Type declaration

    • (config, core, extensions, pluginChain?): void
    • Parameters

      • config: IConfiguration

        The config for the plugin to use

      • core: IAppInsightsCore<IConfiguration>

        The current App Insights core to use for initializing this plugin instance

      • extensions: IPlugin[]

        The complete set of extensions to be used for initializing the plugin

      • OptionalpluginChain: ITelemetryPluginChain

        [Optional] specifies the current plugin chain which identifies the set of plugins and the order they should be executed for the current request.

      Returns void

isInitialized?: (() => boolean)

Returns a value that indicates whether the plugin has already been previously initialized. New plugins should implement this method to avoid being initialized more than once.

teardown?: ((unloadCtx: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) => boolean | 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.

Type declaration

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

      • unloadCtx: 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.

version?: string

Plugin version (available in data.properties.version in common schema)

Methods

  • Resets the ajax attempts counter. This is typically called on page view to allow a fresh set of ajax calls to be tracked.

    Returns void