Provides data transmission capabilities

interface IChannelControls {
    core?: IAppInsightsCore<IConfiguration>;
    flush?(async: boolean, callBack?: ((flushComplete?: boolean) => void), sendReason?: SendRequestReason): boolean | void | IPromise<boolean>;
    getOfflineSupport?: (() => IInternalOfflineSupport);
    identifier: string;
    initialize: ((config: IConfiguration, core: IAppInsightsCore<IConfiguration>, extensions: IPlugin[], pluginChain?: ITelemetryPluginChain) => void);
    isInitialized?: (() => boolean);
    pause?(): void;
    priority: number;
    processTelemetry: ((env: ITelemetryItem, itemCtx?: IProcessTelemetryContext) => void);
    resume?(): void;
    setNextPlugin?: ((next: ITelemetryPlugin | ITelemetryPluginChain) => void);
    teardown?: ((unloadCtx?: IProcessTelemetryUnloadContext, unloadState?: ITelemetryUnloadState) => boolean | void);
    update?: ((updateCtx: IProcessTelemetryUpdateContext, updateState: ITelemetryUpdateState) => boolean | void);
    version?: string;
}

Hierarchy (view full)

Properties

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.

getOfflineSupport?: (() => IInternalOfflineSupport)

Get offline support

Type declaration

identifier: string

Extension name

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.

priority: number

Priority of the extension

processTelemetry: ((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

      • 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

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

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

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

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

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

The the plugin should re-evaluate configuration and update any cached configuration settings or plugins. If implemented this method will be called whenever a plugin is added or removed and if the configuration has bee updated.

Type declaration

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

      Returns boolean | void

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

version?: string

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

Methods

  • Flush to send data immediately; channel should default to sending data asynchronously. If executing asynchronously and you DO NOT pass a callback function then a IPromise will be returned which will resolve once the flush 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

    • async: boolean

      send data asynchronously when true

    • 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

    Returns boolean | void | IPromise<boolean>

    • If a callback is provided true to indicate that callback will be called after the flush is complete otherwise the caller should assume that any provided callback will never be called, 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 async is true.