-
Notifications
You must be signed in to change notification settings - Fork 242
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Offline Support][BUG] @microsoft/applicationinsights-offlinechannel-js
- persisted data is not being send when coming online
#2368
Comments
@microsoft/applicationinsights-offlinechannel-js
- persisted data is not being send when coming online
Hi, if you want to use a pinned version, please check this table: https://github.com/microsoft/applicationinsights-react-js?tab=readme-ov-file#compatibility-matrix
|
To clarify:
|
I'm aware of this, it's a bit of an issue when trying to use the most recent releases, e.g.
Thanks for the additional information :)! So I'd assume above mentioned setup should work and the persisted data should have been send after setting |
The current state of the versions with the Offline listener, AISKU and react-js is "messy", as part of the new release of the offline channel we had to make changes to the internal interfaces, while the latest offline "should" work with the 3.2.0 of the applicationinsights-web, it's not our recommended approach. You should use the offline channel that matches the version of the applicationinsights-web (AISKU). We believe that the issue with the react-js compile issues are due to older versions within the node_modules dependency chain -- clearing and updating all of the dependencies (especially for the react-js plugin) "should" fix the compile issue. |
@MSNev Appreciate the input regarding the ts issue. Added a small demo repo here, where I was also playing around with rec_2.movI'd appreciate any hints / clarifications whether this is the intended behavior or can/needs to be configured somewhere. None of the |
I'll let @Karlie-777 and @siyuniu-ms respond with any details from investigations etc. But for reference the Offline Channel was designed to store "batches" of events and when it comes back online it sends out these batches one at a time in a slow manner (as to not overload the network) and only "if" it detects that the normal online channel (Sender / Post) don't have anything waiting or are not current sending anything (ie. they are deemed idle -- again so we don't overload the network bandwidth). So because it's designed for batches, when you are offline for an extended period of time the events "trickling" in will be automatically grouped into their own batches based on a bunch of stuff -- mostly time and total number (@Karlie-777 can elaborate more -- they should all have configuration options). So depending on the frequency of the events and these settings will determine the number of batches that get created and store (and then subsequently sent after coming back online). The key goal (beyond just saving the events while offline) was to not overload the network bandwidth of not just the users machine but also any shared infrastructure (eg. a small company with 100 users who have been offline for several hours, when their internet connection comes back on we don't want to get sending errors (timeouts) because there is not network bandwidth by dumping 1000's of events the moment internet connection is detected and restored (by whatever mechanism is needed -- this is where the IOfflineListerner interface comes in) |
Thanks for the in depth answer. That clears up quite a lot of things for me in regards to how the offline channel is supposed to work / be used. @Karlie-777 & @siyuniu-ms please let me know If I can provide anything else to help with your investigations :). |
do you mind trying adding some fields(for example isonline: false/true) to the events or name events as "offline"/"online" to mark events? |
Description/Screenshot
I'm currently trying to get the new offline channel to work so we don't miss any events when users are offline (in a pwa context). I've pretty much followed the implementation in the docs here. When setting
offlineListener.setOnlineState(2)
, I can see that events are being persisted in the chosen storage (in my case local storage with keyAIOffline_1_*
). When coming back online and byofflineListener.setOnlineState(1)
the collected data is not send, even when waiting themaxSentBatchInterval
default time of 15s.Steps to Reproduce
Relevant dep. versions:
(Side-note, we made the conscious decision to use pinned versions, I cannot get this to work however due to same issue described in #95. Need to use semver range, otherwise getting ts build-time errors. Error is:
Argument of type 'OfflineChannel' is not assignable to parameter of type 'IPlugin'.
Will provide a different issue for that.)Then just in a different component/page:
and likewise
Expected behavior
When coming back online by setting
offlineListener.setOnlineState(1)
, persisted events should be sent to ai.Additional context
Not sure if I'm missing something, since docs say
A post or sender channel is required for processing online events
. Not quite clear to me whether I need to explicitly register/add this to the app insights instance?Will provide a repository for repro as soon as I have time.
The text was updated successfully, but these errors were encountered: