The IOfflineChannelConfiguration interface defines the configuration options for offline channel, supports offline events storage, retrieval and re-sending.

interface IOfflineChannelConfiguration {
    autoClean?: boolean;
    customProvider?: IOfflineProvider;
    customUnloadProvider?: IOfflineProvider;
    eventsLimitInMem?: number;
    EventsToDropPerTime?: number;
    indexedDbName?: string;
    inMemoMaxTime?: number;
    inStorageMaxTime?: number;
    maxBatchsize?: number;
    maxCriticalEvtsDropCnt?: number;
    maxRetry?: number;
    maxSentBatchInterval?: number;
    maxStorageSizeInBytes?: number;
    minPersistenceLevel?: number;
    overrideInstrumentationKey?: string;
    primaryOnlineChannelId?: string[];
    providers?: number[] | eStorageProviders[];
    senderCfg?: IOfflineSenderConfig;
    splitEvts?: boolean;
    storageKeyPrefix?: string;
}

Properties

autoClean?: boolean

[Optional] Identifies if events that have existed in storage longer than the maximum allowed time (configured in inStorageMaxTime) should be cleaned after connection with storage. If not provided, default is false

customProvider?: IOfflineProvider

[Optional] Custom provider that can be used instead of the provided LocalStorage, SessionStorage, IndexedDB. Default: null

3.9.10

customUnloadProvider?: IOfflineProvider

[Optional] Custom unload provider should be used for handling unload scenarios. This provider should support synchronous operations (supportsSyncRequests should return true) If the unload provider is not provided, the provided customProvider will be used if it supports sync requests, otherwise localStorage will be used by default. Default: null

3.9.10

eventsLimitInMem?: number

[Optional] Identifies the maximum number of events to store in each memory batch before sending to persistent storage. For versions > 3.3.2, new config splitEvts is added If splitEvts is set true, eventsLimitInMem will be applied to each persistent level batch

EventsToDropPerTime?: number

Identifies the maximum event batch count when cleaning or releasing space for persistent storage per time. default 10

indexedDbName?: string

[Optional] The IndexedDb database name that should be used when storing events using (window||globalThis||self).indexedDb.

inMemoMaxTime?: number

[Optional] Identifies the maximum time in ms that items should be in memory before being saved into storage.

15000
inStorageMaxTime?: number

[Optional] Identifies the maximum time in ms that items should be in persistent storage. default: 10080000 (around 2.8 hours) for versions <= 3.3.0 default: 604800000 (around 7days) for versions > 3.3.0

maxBatchsize?: number

Identifies the maximum size per batch in bytes that is saved in persistent storage. default 63000

maxCriticalEvtsDropCnt?: number

Identifies the maximum critical events count for an event batch to be able to drop when releasing space for persistent storage per time. default 2

maxRetry?: number

[Optional] Identifies the maximum retry times for an event batch. default: 1

maxSentBatchInterval?: number

Identifies the interval time in ms that previously stored offline event batches should be sent under online status. default 15000

maxStorageSizeInBytes?: number

[Optional] The max size in bytes that should be used for storing events(default up to 5 Mb) in local/session storage. The maximum size in bytes that should be used for storing events in storage If not specified, the system will use up to 5 MB

5000000
minPersistenceLevel?: number

[Optional] Identifies the minimum level that will be cached in the offline channel. Valid values of this setting are defined by the EventPersistence enum, currently Normal (1) and Critical (2) with the default value being Normal (1), which means all events without a persistence level set or with invalid persistence level will be marked as Normal(1) events.

1
overrideInstrumentationKey?: string

Identifies overridden for the Instrumentation key when the offline channel calls processTelemetry.

primaryOnlineChannelId?: string[]

Identifies online channel IDs in order. The first available one will be used. default is [AppInsightsChannelPlugin, PostChannel]

providers?: number[] | eStorageProviders[]

[Optional] Identifies the StorageProviders that should be used by the system if available, the first available provider will be used. Valid available values are defined by the eStorageProviders enum. Only the first 5 entries are processed, so if this value contains more than 5 elements they will be ignored. Note: LocalStorage will be used to save unload events even if it is not in the providers list Default order is [StorageProviders.LocalStorage, StorageProviders.IndexedDB]

Identifies offline sender properties. If not defined, settings will be the same as the online channel configured in primaryOnlineChannelId.

splitEvts?: boolean

Identifies when saving events into the persistent storage, events will be batched and saved separately based on persistence level this is useful to help reduce the loss of critical events during cleaning process but it will result in more frequest storage implementations. If it is set to false, all events will be saved into single in memory batch Default: false

storageKeyPrefix?: string

[Optional] The storage key prefix that should be used when storing events in persistent storage.

AIOffline