Start measuring your success with Application Insights free with DreamSpark


To start using the Visual Studio Application Insights SDK in your app.

For those of you not familiar with Application Insights, the service collects telemetry data from your app and uses Azure to store the data. The Windows Dev Center can access this telemetry data to provide you with a view into how customers are using your app.

You can use Visual Studio 2015 or 2013 to add Application Insights to your app in about 10 minutes. To get started, open up your Windows app (Windows 8 or 10 – client or phone), and do the following:

addAppInsight_10x10week1

  1. Right click on your project in Visual Studio and select ‘Add Application Insights Telemetry…’
  2. Application Insights will then launch a wizard that walks you through adding the service into your Windows app. As part of this process, it will ask you where you want to keep your data (if you don’t already have a free Azure account, you’ll need to create one simply activate your Free DreamSpark Azure subscription https://www.dreamspark.com/Product/Product.aspx?productid=99 
  3. Once you’re done with the wizard, it will set up and configure your project for telemetry collection.

appInsight_10x10week1

At this point, you’ll be able to see on Azure, in near real-time, how many folks are using your app in the wild. This telemetry can tell you a lot about your app and where to direct your development efforts – you can measure what features are being used, by how many people, and for how long.

And once you publish your app into the Store and enable the app usage telemetry setting on the Windows Dev Center dashboard (under ‘Account settings’), the data will be visible on the Usage report.

You can then use the TelemetryClient class to gather additional telemetry data like page views (or even pivot/hub control activity), interesting events you want tracked, and exceptions. Beyond the basic page telemetry you get by using Application Insights, you can taking advantage of exception tracking to get a near real-time view into trouble spots (particularly useful when launching an update to the public). To track exceptions, use the following code

try

{

// ...

}

catch (Exception ex)

{

private TelemetryClient telemetry = new TelemetryClient();

telemetry.TrackException(ex);

}

As you get more comfortable with analytics, you can start instrumenting all kinds of things. For example, this sample code tracks how long it takes to accomplish a task:

var stopwatch = System.Diagnostics.Stopwatch.StartNew();

// ... perform the timed action ...

stopwatch.Stop();

var metrics = new Dictionary <string, double>

{{"processingTime", stopwatch.Elapsed.TotalMilliseconds}};

// Set up some properties:

var properties = new Dictionary <string, string>

{{"signalSource", currentSignalSource.Name}};

// Send the event:

private TelemetryClient telemetry = new TelemetryClient();

telemetry.TrackEvent("SignalProcessed", properties, metrics);

Get started with Application Insights

Application Insights comes as part of Visual Studio with automatic instrumentation for ASP.NET or Windows developers. You get vital application telemetry data out of the box, including usage, exceptions/crashes, requests, performance & logs.

Enable monitoring for Azure web apps and VMs directly via Azure portal or install Status Monitor on your ASP.NET web server to get performance monitoring without need to update code and redeploy your application.

Easily add Application Insights SDK to Java, iOS or Android apps. Monitor apps written in languages like Ruby, Python, PHP, Node.JS, etc. with open source SDKs on GitHub.

Explore supported platforms

Comments (0)