Understanding Your Applications Availability, Performance, and Usage with Application Insights

Share on facebook
Share on twitter
Share on linkedin

Do you know if your site is up and running?  How responsive is your site? If your application is generating errors, do you know that? Do you know the features and demographics of the users? If you are not sure or answered no to any of these questions, Application Insights is powerful tool that can help you understand the availability, performance, and usage of your application.

Application Insights is a cloud based tool by Microsoft that allows you understand your application’s availability, performance, and usage.  Currently available in preview, the tool is available for a number of platforms including ASP.NET web applications and WCF services, Windows Phone and Windows Store apps.  Microsoft has recently announced the purchase of HockeyApp that will add support for mobile devices.

The following post will show how to add Application Insights in just a couple steps to start betting understanding your application.

General Requirements

There are two basic requirements to getting started with Application Insights.  The first requirement is a Microsoft Azure account.  You can create one a number of ways including activating your MSDN Azure benefits.  This doesn’t require a credit card and provides you with $50, $100, or $150 of discounted Azure spending each month.  There is no better way to get started trying out all of the Azure features.  Second, Application Insights has worked with a number of updates in Visual Studio 2013, but I would recommend installing VS 2013 Update 3 or greater to get the best experience and utilize the Azure portal version.  Prior to Update 3, the previous version of the client tools used Application Insights in Visual Studio Online. 

Add Application Insights to a New Application

To add Application Insights for a new project, check the box to Add Application Insights to Project in the new project wizard.  Select your account and the location where to send the telemetry data.  In this case I chose a new project based on the name of my application.  The dialog gives you the control to choose the exact settings you want.  Once you have created your application and run it for the first time, it will immediately begin sending telemetry data.

SNAGHTML5b93b8c.png

Add Application Insights to an Existing Application

In many cases you will have existing applications that you want to begin capturing telemetry data.  Fortunately adding Application Insights to your existing application is almost as simple as setting it up for a new application.  Basically there is only one additional step.

Here we have an existing ASP.NET MVC application.  To add Application Insights, right click on the project and choose the Add Application Insights Telemetry option.

SNAGHTML5bad67f.png

This adds the necessary configuration, creates the resource in Azure, and installs NuGet packages to your application.  At this point, the all of the telemetry data is configured to send except for the client side capturing.

The one telemetry item that isn’t automatically configured when setting up Application Insights for existing applications is the end-user usage analytics.  For a new MVC application this is added to the layout page.  For an existing application, we need to go to the Azure Portal, choose Quick start > Add code to monitor web pages.

SNAGHTMLfe43f6f.png

This displays the required code for your application with your specific instrumentation key already included.  Copy this to the clipboard.

SNAGHTMLfe56d415B45D.png

With this, paste the code into the layout page just as the new project wizard would have done like this.

SNAGHTML1013f7be.png

Run the application and it will start sending telemetry data.

As you can see, in just a couple steps you can add Application Insights telemetry data to your new and existing applications.   Use this to understand your application’s availability, performance, and usage.

More information

New features are being release for Application Insights on a regular basis.  Follow these links for the latest updates.

Announcements on the Microsoft ALM Blog

http://blogs.msdn.com/b/visualstudioalm/archive/tags/application+insights/

Release Notes on Microsoft Azure

http://azure.microsoft.com/en-us/updates/?service=visual-studio-online

More to explore