0.2.0 • Published 2 days ago

@microsoft/applicationinsights-offlinechannel-js v0.2.0

Weekly downloads
-
License
MIT
Repository
-
Last release
2 days ago

Microsoft Application Insights JavaScript SDK - Offline Channel

Beta

Description

The Offline Channel supports the saving of events when your application is offline and resending those events when the application is online.

Note

  • A post or sender channel is required for processing online events.
  • Request header details will be stored in local/session storage or IndexedDB based on your configuration.
  • If you are using the default endpoint https://dc.services.visualstudio.com for Application Insights, partial success is currently considered as success and events not sent in partial success will be dropped.

Configuration

IOfflineChannelConfiguration

NameTypeDefaultDescription
maxStorageSizeInBytesOptional5000000The max size in bytes that should be used for storing events.
storageKeyPrefixOptionalAIOfflineThe storage key prefix that should be used when storing events in persistent storage.
minPersistenceLevelOptionalEventPersistence.Normal or 1Identifies 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.
providersOptionaleStorageProviders.LocalStorage, eStorageProviders.IndexedDBIdentifies 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. Note: LocalStorage will be used to save unload events even if it is not in the providers list.
eventsLimitInMemOptionalnullIdentifies the maximum number of events to store in memory before sending to persistent storage.
autoCleanOptionalfalseIdentifies if events that have existed in storage longer than the maximum allowed time (configured in inStorageMaxTime) should be cleaned after connection with storage.
inMemoMaxTimeOptional15000Identifies the maximum time in ms that items should be in memory before being saved into storage.
inStorageMaxTimeOptional10080000 (around 7days)Identifies the maximum time in ms that items should be in the configured persistent storage.
maxRetryOptional1Identifies the maximum retry times for an event batch.
primaryOnlineChannelIdOptional[AppInsightsChannelPlugin, PostChannel]Identifies online channel IDs in order. The first available one will be used.
maxBatchsizeOptional63000Identifies the maximum size per batch in bytes that is saved in persistent storage.
senderCfgOptionalIOfflineSenderConfigIdentifies offline sender properties.
maxSentBatchIntervalOptional15000Identifies the interval time in ms that previously stored offline event batches should be sent under online status.
EventsToDropPerTimeOptional10Identifies the maximum event batch count when cleaning or releasing space for persistent storage per time.
maxCriticalEvtsDropCntOptional2Identifies the maximum critical events count for an event batch to be able to drop when releasing space for persistent storage per time.
overrideInstrumentationKeyOptionalnullIdentifies overridden for the Instrumentation key when the offline channel calls processTelemetry.

IOfflineSenderConfig

NameTypeDefaultDescription
retryCodesOptional[401, 403, 408, 429, 500, 502, 503, 504]Identifies status codes for re-sending event batches.
transportsOptionalnullEither an array or single value identifying the requested TransportType type(s) that should be used for sending events. If not defined, the same transports will be used in the channel with the primaryOnlineChannelI.
httpXHROverrideOptionalnullThe HTTP override that should be used to send requests, as an IXHROverride object.
alwaysUseXhrOverrideOptionalfalseIdentifies if provided httpXhrOverride will always be used.

Contributing

Read our contributing guide to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes to Application Insights.

Data Collection

As this SDK is designed to enable applications to perform data collection which is sent to the Microsoft collection endpoints the following is required to identify our privacy statement.

The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft�s privacy statement. Our privacy statement is located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft�s Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party�s policies.

License

MIT