Identifies an interface to a host that can provide an IPerfManager implementation

interface IAppInsightsCore<CfgType> {
    activeStatus?: (() => number);
    addNotificationListener?(listener: INotificationListener): void;
    addPlugin<T>(plugin: T, replaceExisting?: boolean, doAsync?: boolean, addCb?: ((added?: boolean) => void)): void;
    addTelemetryInitializer(telemetryInitializer: TelemetryInitializerFunction): ITelemetryInitializerHandler;
    addUnloadCb(handler: UnloadHandler): void;
    addUnloadHook(hooks:
        | IUnloadHook
        | ILegacyUnloadHook
        | Iterator<IUnloadHook, any, undefined>
        | Iterator<ILegacyUnloadHook, any, undefined>
        | IUnloadHook[]
        | ILegacyUnloadHook[]): void;
    config: CfgType;
    evtNamespace(): string;
    flush(isAsync?: boolean, callBack?: ((flushComplete?: boolean) => void), sendReason?: SendRequestReason, cbTimeout?: number): boolean | void;
    getChannels(): IChannelControls[];
    getCookieMgr(): ICookieMgr;
    getNotifyMgr(): INotificationManager;
    getPerfMgr(): IPerfManager;
    getPlugin<T>(pluginIdentifier: string): ILoadedPlugin<T>;
    getProcessTelContext(): IProcessTelemetryContext;
    getTraceCtx(createNew?: boolean): IDistributedTraceContext;
    getWParam: (() => number);
    initialize(config: CfgType, extensions: IPlugin[], logger?: IDiagnosticLogger, notificationManager?: INotificationManager): void;
    isInitialized?: (() => boolean);
    logger: IDiagnosticLogger;
    onCfgChange(handler: WatcherFunction<CfgType>): IUnloadHook;
    pluginVersionString: string;
    pluginVersionStringArr: string[];
    pollInternalLogs?(eventName?: string): ITimerHandler;
    removeNotificationListener?(listener: INotificationListener): void;
    setCookieMgr(cookieMgr: ICookieMgr): void;
    setPerfMgr(perfMgr: IPerfManager): void;
    setTraceCtx(newTraceCtx: IDistributedTraceContext): void;
    stopPollingInternalLogs?(): void;
    track(telemetryItem: ITelemetryItem): void;
    unload(isAsync?: boolean, unloadComplete?: ((unloadState: ITelemetryUnloadState) => void), cbTimeout?: number): void | IPromise<ITelemetryUnloadState>;
    updateCfg(newConfig: CfgType, mergeExisting?: boolean): void;
}

Type Parameters

Hierarchy (view full)

Implemented by

Properties

activeStatus?: (() => number)

Watches and tracks status of initialization process

Type declaration

    • (): number
    • Returns number

      ActiveStatus

3.3.0 If returned status is active, it means initialization process is completed. If returned status is pending, it means the initialization process is waiting for promieses to be resolved. If returned status is inactive, it means ikey is invalid or can 't get ikey or enpoint url from promsises.

config: CfgType
getWParam: (() => number)

Function used to identify the get w parameter used to identify status bit to some channels

isInitialized?: (() => boolean)

Returns a value that indicates whether the instance has already been previously initialized.

The current logger instance for this instance.

pluginVersionString: string

The formatted string of the installed plugins that contain a version number

pluginVersionStringArr: string[]

An array of the installed plugins that provide a version

Methods

  • Adds a notification listener. The SDK calls methods on the listener when an appropriate notification is raised. The added plugins must raise notifications. If the plugins do not implement the notifications, then no methods will be called.

    Parameters

    Returns void

  • Add a new plugin to the installation

    Type Parameters

    Parameters

    • plugin: T

      The new plugin to add

    • OptionalreplaceExisting: boolean

      should any existing plugin be replaced, default is false

    • OptionaldoAsync: boolean

      Should the add be performed asynchronously

    • OptionaladdCb: ((added?: boolean) => void)

      [Optional] callback to call after the plugin has been added

        • (added?): void
        • Parameters

          • Optionaladded: boolean

          Returns void

    Returns void

  • Flush and send any batched / cached data immediately

    Parameters

    • OptionalisAsync: boolean
    • OptionalcallBack: ((flushComplete?: boolean) => void)

      if specified, notify caller when send is complete, the channel should return true to indicate to the caller that it will be called. If the caller doesn't return true the caller should assume that it may never be called.

        • (flushComplete?): void
        • Parameters

          • OptionalflushComplete: boolean

          Returns void

    • OptionalsendReason: SendRequestReason

      specify the reason that you are calling "flush" defaults to ManualFlush (1) if not specified

    • OptionalcbTimeout: number

      An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.

    Returns boolean | void

    • true if the callback will be return after the flush is complete otherwise the caller should assume that any provided callback will never be called
  • Unload and Tear down the SDK and any initialized plugins, after calling this the SDK will be considered to be un-initialized and non-operational, re-initializing the SDK should only be attempted if the previous unload call return true stating that all plugins reported that they also unloaded, the recommended approach is to create a new instance and initialize that instance. This is due to possible unexpected side effects caused by plugins not supporting unload / teardown, unable to successfully remove any global references or they may just be completing the unload process asynchronously. If you pass isAsync as true (also the default) and DO NOT pass a callback function then an IPromise will be returned which will resolve once the unload is complete. The actual implementation of the IPromise will be a native Promise (if supported) or the default as supplied by ts-async library

    Parameters

    • OptionalisAsync: boolean

      Can the unload be performed asynchronously (default)

    • OptionalunloadComplete: ((unloadState: ITelemetryUnloadState) => void)

      An optional callback that will be called once the unload has completed

    • OptionalcbTimeout: number

      An optional timeout to wait for any flush operations to complete before proceeding with the unload. Defaults to 5 seconds.

    Returns void | IPromise<ITelemetryUnloadState>

    Nothing or if occurring asynchronously a IPromise which will be resolved once the unload is complete, the IPromise will only be returned when no callback is provided and isAsync is true

  • Update the configuration used and broadcast the changes to all loaded plugins, this does NOT support updating, adding or removing any the plugins (extensions or channels). It will notify each plugin (if supported) that the configuration has changed but it will not remove or add any new plugins, you need to call addPlugin or getPlugin(identifier).remove();

    Parameters

    • newConfig: CfgType

      The new configuration is apply

    • OptionalmergeExisting: boolean

      Should the new configuration merge with the existing or just replace it. Default is to merge.

    Returns void