App Insights Telemetry not sending when offline
Asked Answered
G

2

7

I am using application insights sdk for a wpf app I've been working on to capture some simple telemetry. I am loading the configuration file that looks like this

<?xml version="1.0" encoding="utf-8"?>
<ApplicationInsights xmlns="http://schemas.microsoft.com/ApplicationInsights/2013/Settings">
<TelemetryChannel Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.ServerTelemetryChannel, Microsoft.AI.ServerTelemetryChannel"/>
<TelemetryProcessors>
    <Add Type="Microsoft.ApplicationInsights.Extensibility.AutocollectedMetricsExtractor, Microsoft.ApplicationInsights"/>
    <Add Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.AdaptiveSamplingTelemetryProcessor, Microsoft.AI.ServerTelemetryChannel">
        <MaxTelemetryItemsPerSecond>5</MaxTelemetryItemsPerSecond>
        <ExcludedTypes>Event</ExcludedTypes>
    </Add>
    <Add Type="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel.AdaptiveSamplingTelemetryProcessor, Microsoft.AI.ServerTelemetryChannel">
        <MaxTelemetryItemsPerSecond>5</MaxTelemetryItemsPerSecond>
        <IncludedTypes>Event</IncludedTypes>
    </Add>
</TelemetryProcessors>

The problem is when I run the installed application and am offline the telemetry is captured just fine. Next time I open the app when I'm online that data eventually gets pushed out to app insights. But when anyone else runs the application offline their data never ends up getting pushed to app insights when they come back online.

Is there something wrong here in the way that this is configured? Why would this work for some users but not others?

edit: Working with a user today I noticed that when they are offline and running the app there is no temporary file that is saved. When I do the same thing on my computer I notice a weird temp file gets created. When I run the app when back online it disappears.

Guardianship answered 4/5, 2018 at 21:14 Comment(0)
G
7

What I have found after debugging on the user's machine and digging through the code is that the server telemetry channel uses this function NetworkInterface.GetIsNetworkAvailable(); which always returns true for my users even when they are offline because they have some extra network adapters that think they are connected to an unknown network.

Guardianship answered 9/5, 2018 at 3:28 Comment(0)
A
-1

Did you check https://learn.microsoft.com/en-us/azure/application-insights/app-insights-asp-net-troubleshoot-no-data or tried to run your app using other machine? Looks like it can be a firewall issue or something like that.

Areaway answered 9/5, 2018 at 19:40 Comment(1)
See my answer above. It was basically because there is a check in the server telemetry channel code to see if the user can send data to app insights or if it should save it locally. The check that it makes is not whether the user is connected to the internet, its whether the user is connected to a network. My users were connected to a network but not the internet, so that channel would just try and push out data to app insights which would fail, and the local file would never get saved.Guardianship

© 2022 - 2024 — McMap. All rights reserved.