ApplicationInsights-JS icon indicating copy to clipboard operation
ApplicationInsights-JS copied to clipboard

Preserve Telemetry for PWA Scenario

Open davesauce14 opened this issue 5 years ago • 4 comments

Feature Request: Add LocalStorage Telemetry Preservation

In the case of progresive web apps, the user can be offline for long periods of time, closing and opening the app all the while. In this scenario, because we are using sessionStorage the telemetry is getting wiped on refresh / reloading the PWA. It would be great if we could add the ability to specify localStorage in addition to sessionStorage and localBufferArray to preserve the telemetry for longer.

davesauce14 avatar Apr 21 '21 05:04 davesauce14

Hi @MSNev I see that 2.6.2 has been built, that is great news! I am trying to make my application use these changes, but we are loading ai.js via .net snippit and its still pointing to 2.6.1. @inject Microsoft.ApplicationInsights.AspNetCore.JavaScriptSnippet JavaScriptSnippet https://docs.microsoft.com/en-us/azure/azure-monitor/app/asp-net-core#enable-client-side-telemetry-for-web-applications

https://az416426.vo.msecnd.net/scripts/b/ai.2.min.js This url still points to 2.6.1, can you tell me how I can achieve my goal using this same snippit approach?

davesauce14 avatar Apr 26 '21 22:04 davesauce14

Hi @davesauce14 v2.6.2 will be promoted as the default version to the link above tomorrow (I generally do this in the morning PDT time). I also have additional rollout progress notes for the milestone for this release https://github.com/microsoft/ApplicationInsights-JS/milestone/49

Right now, you can use the beta or next URL's which will return v2.6.2 (next is https://js.monitor.azure.com/next/ai.2.min.js) and for reference either https://az416426.vo.msecnd.net and https://js.monitor.azure.com can be used.

We are promoting js.monitor.azure.com as the preferred domain to load the SDK from as this technically is a CNAME, that allows us to redirect the source to a different CDN host provider should there be an issue (which we have had a couple of times), while the az416426.vo.msecnd.net domain is a Verizon owned and controlled domain that we cannot redirect.

MSNev avatar Apr 26 '21 23:04 MSNev

@MSNev Makes sense, I see that https://js.monitor.azure.com/next/ai.2.min.js points to the latest, but https://az416426.vo.msecnd.net/scripts/b/ai.2.min.js which is what the .net SDK points to is still 2.6.1 I dont see any way to change the url in the configuration for the JavaScriptSnippet

davesauce14 avatar Apr 27 '21 17:04 davesauce14

I just pushed the button to promote v2.6.2 as the primary version on the "public" (main, scripts/b/...), so this should be fully replicated globally in the next 15-30 mins.

So you should see it very shortly.

MSNev avatar Apr 27 '21 17:04 MSNev