Class that manages adding events to inbound queues and batching of events into requests.

Hierarchy

  • BaseTelemetryPlugin
    • PostChannel

Implements

Constructors

Properties

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

Type declaration

    • (unloadCtx?, unloadState?, asyncCallback?): boolean | void
    • Teardown / Unload hook to allow implementations to perform some additional unload operations before the BaseTelemetryPlugin finishes it's removal.

      Parameters

      • Optional unloadCtx: IProcessTelemetryUnloadContext

        This is the context that should be used during unloading.

      • Optional unloadState: 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.

      • Optional asyncCallback: (() => 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?, updateState?, asyncCallback?) => boolean | void)

Type declaration

    • (updateCtx?, updateState?, asyncCallback?): boolean | void
    • Extension hook to allow implementations to perform some additional update operations before the BaseTelemetryPlugin finishes it's removal

      Parameters

      • Optional updateCtx: IProcessTelemetryUpdateContext

        This is the context that should be used during updating.

      • Optional updateState: ITelemetryUpdateState

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

      • Optional asyncCallback: (() => 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)

Type declaration

    • (currentCtx?): 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.

      Parameters

      • Optional currentCtx: 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?) => IDiagnosticLogger)

Type declaration

    • (itemCtx?): 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.

      Parameters

      • Optional itemCtx: IProcessTelemetryContext

      Returns IDiagnosticLogger

identifier: string = "PostChannel"

Extension name

isInitialized: (() => boolean)

Type declaration

    • (): boolean
    • Returns whether the plugin has been initialized

      Returns boolean

priority: number = 1011

Priority of the extension

processNext: ((env, itemCtx) => void)

Type declaration

    • (env, itemCtx): void
    • Call back for telemetry processing before it it is sent

      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) => void)

Type declaration

    • (isInitialized): void
    • Internal helper to allow setting of the internal initialized setting for inherited instances and unit testing

      Parameters

      • isInitialized: boolean

      Returns void

setNextPlugin: ((next) => void)

Type declaration

    • (next): void
    • Set next extension for telemetry processing

      Parameters

      • next: ITelemetryPlugin | ITelemetryPluginChain

      Returns void

version: string = "#version#"

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

Methods

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

    Parameters

    • hooks: ILegacyUnloadHook | IUnloadHook | IUnloadHook[] | Iterator<IUnloadHook, any, undefined> | 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

  • Load custom transmission profiles. Each profile should have timers for real time, and normal and can optionally specify the immediate latency time in ms (defaults to 0 when not defined). Each profile should make sure that a each normal latency timer is a multiple of the real-time latency and the immediate is smaller than the real-time. Setting the timer value to -1 means that the events for that latency will not be scheduled to be sent. Note that once a latency has been set to not send, all latencies below it will also not be sent. The timers should be in the form of [normal, high, [immediate]]. e.g Custom: [10,5] - Sets the normal latency time to 10 seconds and real-time to 5 seconds; Immediate will default to 0ms [10,5,1] - Sets the normal latency time to 10 seconds and real-time to 5 seconds; Immediate will default to 1ms [10,5,0] - Sets the normal latency time to 10 seconds and real-time to 5 seconds; Immediate will default to 0ms [10,5,-1] - Sets the normal latency time to 10 seconds and real-time to 5 seconds; Immediate events will not be scheduled on their own and but they will be included with real-time or normal events as the first events in a batch. This also removes any previously loaded custom profiles.

    Parameters

    • profiles: {
          [profileName: string]: number[];
      }

      A dictionary containing the transmit profiles.

      • [profileName: string]: number[]

    Returns void

  • Set the transmit profile to be used. This will change the transmission timers based on the transmit profile.

    Parameters

    • profileName: string

      The name of the transmit profile to be used.

    Returns void

  • Add handler to be executed with request response text.

    Parameters

    • responseHanlder: ((responseText) => void)
        • (responseText): void
        • Parameters

          • responseText: string

          Returns void

    Returns IUnloadHook

  • Flush to send data immediately; channel should default to sending data asynchronously. If executing asynchronously (the default) 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 = true

      send data asynchronously when true

    • Optional callBack: ((flushComplete?) => 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

          • Optional flushComplete: boolean

          Returns void

    • Optional sendReason: 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.
  • Get Offline support

    Returns IInternalOfflineSupport

    internal Offline support interface IInternalOfflineSupport

  • Check if there are any events waiting to be scheduled for sending.

    Returns boolean

    True if there are events, false otherwise.

  • Start the queue manager to batch and send events via post.

    Parameters

    • coreConfig: IExtendedConfiguration
    • core: IAppInsightsCore<IConfiguration>
    • extensions: IPlugin[]

    Returns void

  • Pause the transmission of any requests

    Returns void

  • Add an event to the appropriate inbound queue based on its latency.

    Parameters

    • ev: ITelemetryItem

      The event to be added to the queue.

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

  • remove AuthPlugin Header

    Parameters

    • token: string

      token value.

    Returns void

  • Resumes transmission of events.

    Returns void

  • Set setAuthPluginHeader header

    Parameters

    • token: string

      token value.

    Returns void

  • Sets the event queue limits at runtime (after initialization), if the number of queued events is greater than the eventLimit or autoFlushLimit then a flush() operation will be scheduled.

    Parameters

    • eventLimit: number

      The number of events that can be kept in memory before the SDK starts to drop events. If the value passed is less than or equal to zero the value will be reset to the default (10,000).

    • Optional autoFlushLimit: number

      When defined, once this number of events has been queued the system perform a flush() to send the queued events without waiting for the normal schedule timers. Passing undefined, null or a value less than or equal to zero will disable the auto flush.

    Returns void

  • Set AuthMsaDeviceTicket header

    Parameters

    • ticket: string

      Ticket value.

    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

    • Optional unloadCtx: IProcessTelemetryUnloadContext

      This is the context that should be used during unloading.

    • Optional unloadState: 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.

Generated using TypeDoc