Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

App Insights Telemetry not sending when offline

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.

like image 273
Matthew The Terrible Avatar asked May 04 '18 21:05

Matthew The Terrible


People also ask

What is telemetry in application insights?

Application Insights telemetry model defines a way to correlate telemetry to the operation of which it's a part. For example, a request can make a SQL Database calls and recorded diagnostics info. You can set the correlation context for those telemetry items that tie it back to the request telemetry.

Can you export the app insights live trace logs and exception data of your application?

The events you see in the Application Insights portal can be exported to storage in Microsoft Azure in JSON format. From there, you can download your data and write whatever code you need to process it.

How do I get application insights connection string?

Go to the Overview pane of your Application Insights resource. Find your Connection String displayed on the right. Hover over the connection string and select the Copy to clipboard icon.

How long does app insights keep data?

How long is the data kept? Raw data points (that is, items that you can query in Analytics and inspect in Search) are kept for up to 730 days. You can select a retention duration of 30, 60, 90, 120, 180, 270, 365, 550, or 730 days.


1 Answers

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.

like image 132
Matthew The Terrible Avatar answered Sep 22 '22 01:09

Matthew The Terrible