Microsoft Application Insights

Home / Microsoft Application Insights

I’ve been watching the #build2015 conference online for the past couple of days. Microsoft has some nice, compelling product announcements.

One that caught my attention was Application Insights. So, I decided to give it a shot with an existing MVC + WebApi web application.


What is Application Insights? It’s essentially a combination of HttpModule that can intercept server requests and log requests, monitor browser response, and test for site availability. Logging is performed through Microsoft Azure. The integration with IIS and ASP.NET is quite seamless. It’s a monitoring tool that lets you seamlessly add monitoring/performance features to an ASP.NET application with minimal effort.

For an existing application, setup is really just a few clicks. To start, within Visual Studio’s Solution Explorer, we right-click the project and add Application Insight to it:

Afterward, we just connect to our Azure account to get an Id assigned to our application. Application Insights refers to these Ids as Application Insights resources.

The next step is to download the IIS Application Status Monitor Preview. I configure it on the Web Applications I want to monitor using the Application Insight Resource that I previously defined.

The final step, if you want to monitor browser response time, is to put a script into your views that will be executed when a page is loaded by the client’s browser. I’m not going to detail this script since it’s directly available from the Azure panel view.

With this minimal amount of set up, we can browse to the Azure Application Insights portal directly from Visual Studio’s Solution Explorer. This is the basic dashboard that shorts server response, browser page load times, total server requests, failed requests, etc.

The side panels show a nice drill-through indicating the requests per page and their average response times. Metrics like this start to become very useful when determining how much load a server can manage or if load balancing is needed.

Overall, I like Microsoft’s Application Insights. Other than Azure licensing, it’s a free product. That’s hard to beat.

There are a few things that it doesn’t do out of the box or with the default configuration. One major thing missing is WebApi tracing. However, there is a Nuget package to add this feature. Install this package like so:

PM> Install-Package Microsoft.AspNet.WebApi.Tracing 

In your HttpConfiguration, enable the tracing:

config.EnableSystemDiagnosticsTracing();

With this configuration in place, all WebApi requests are logged in our server response / server requests metrics. We can drill through to the requests and view their details as well which is pretty handy:

The only other thing that is lacking with Microsoft Application Insights is the ability perform tests against intranet sites. This is an unfortunate side effect of only being able to host Application Insights in Azure. If we were able to host the telemetry tools locally, this wouldn’t be the case. I can understand the limitation, at least. It’s not a complete show-stopper, but it does mean that a specific proxy/end-point, or additionally tooling, that is exposed publicly would have to be made available in order to perform tests against it.

From the Application Insights trouble shooting FAQ:

Can I use Application Insights to monitor an intranet web server?

Yes, you can monitor health and usage if your server can send data to the public internet.
But if you want to run web tests for your service, it must be accessible from the public internet on port 80.

Here are some additionally links that dive a bit deeper into the setup process that I have glossed over:

Get started with Visual Studio Application Insights

Install Application Insights Status Monitor to monitor website performance

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.