Constructors

Properties

config: IConfiguration & IConfig

Methods

  • Add a new plugin to the installation

    Type Parameters

    Parameters

    • plugin: T

      The new plugin to add

    • replaceExisting: boolean

      should any existing plugin be replaced

    • doAsync: boolean

      Should the add be performed asynchronously

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

          • Optionaladded: boolean

          Returns void

    Returns void

  • Parameters

    Returns ITelemetryInitializerHandler

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

    Parameters

    • handler: UnloadHandler

      the handler

    Returns void

  • Returns the unique event namespace that should be used

    Returns string

  • Immediately send all batched telemetry

    Parameters

    • isAsync: boolean = true

      Should the flush be performed asynchronously

    Returns void

  • Find and return the (first) plugin with the specified identifier if present

    Type Parameters

    Parameters

    • pluginIdentifier: string

      The identifier of the plugin to search for

    Returns ILoadedPlugin<T>

  • Gets the current distributed trace context for this instance if available

    Returns IDistributedTraceContext

  • Initialize this instance of ApplicationInsights

    Returns void

  • Watches and tracks changes for accesses to the current config, and if the accessed config changes the handler will be recalled.

    Parameters

    • handler: WatcherFunction<IConfiguration>

      The handler to call when the configuration changes

    Returns IUnloadHook

    A watcher handler instance that can be used to remove itself when being unloaded

  • Returns void

  • Send a manually constructed custom event

    Parameters

    Returns void

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

    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

        • (unloadState): void
        • Parameters

          • unloadState: ITelemetryUnloadState

          Returns void

    • 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

    Type Parameters

    Parameters

    • newConfig: T

      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