In this post, Premier Developer Consultant Adel Ghabboun gives insight on connectivity issues in Azure and how they may effect Application Insights. He gives details about a special disconnection mode that App Insights can run on when such issues arise.
Wondering what happens to Application Insights when applications lose connectivity with Azure? Is telemetry still going to be captured and sent to Application Insights? Will you lose any important performance data about your application? The short answer is NO!
In many cases, your app might lose connectivity to Microsoft Azure. It could have a firewall that prevents access to the portal or even works under a disconnection environment, whether it’s a web or desktop application, or even a Windows service. What happens when either of these occur?
Application Insights uses two built-in channels, InMemoryChannel & ServerTelemetryChannel. The first channel, as implied by its name, processes telemetry items in memory so that there is no intermediate storage. The second channel uses ServerTelemetryChannel by creating a folder under %LOCALAPPDATA% which will be hash of the process name and user. It then stores the encrypted telemetry under that folder. See below screenshot:
The Server Telemetry channel later uses this folder as an intermediate storage for the transactions to send to the Application Insights endpoint. If sending fails, it will retry from this storage later.
However, you would need to make sure to call Flush( ) on the Telemetry Channel object before the process exists (such as On Application Exist) to flush data to the folder before it’s gone from the buffer in memory.
Keep in mind that you can always build your own telemetry channel that will store data in the place of choice and handle the situation up to the requirements. To get further instructions, see this link.