Skip to content

Quick developer tour on Microsoft Application Insights

I am currently working on a new little web application using the good old ASP.Net MVC 5. This application should be hosted on Azure App Service and as our company is highly committed to the Azure Cloud we also have all kind of subscriptions in place. When Visual Studio 2015.3 asked me whether to active the “Application Insights” I quickly decided to do so and created the Azure ResourceGroup as well as set up AppInsight as part of the “New Project” wizard of Visual Studio. I thought this way I can get familiar with AppInsights.

After coding some days on the app I recognised a red square in my code today followed by the text “2 Exceptions”:

appis_1

aw I must click this thing!” came immediately to my mind. Did so:

appis_2

Wait, what? “2 (new)” … ah got it: “2 new NotImplementedException at TfsProjectWriter.CreateProject. The method or operation is not implemented.“. Ok, not to surprising as I am currently in the middle of implementing this application and I ran it quite some times already on my dev machine. But App Insight seems to record these things already and there are these cute little links again one just can not resist to click.

As a developer I first clicked “Go to code”. It took me directly to the code of the “CreateProject” method which shows me the problem. Same thing when clicking the blue method name itself:

image3

Ok, no surprise here and code is always good. But what where those other cute little links?

View all exceptions in this app

This one takes you to a Visual Studio panel where you can query all reported exceptions users experienced in your application. One can sort, filter, drill-down and more – all kind of querying of exception data directly within Visual Studio. You can drill-down and get all the information about the exceptions including inner-exceptions and interactive stack-trace etc.

image4

There are tons of filter options. Not only the exception info but also which user from what location, hardware etc. The kind of information from browser HTTP requests.

From the exception details one can query other exceptions wich may relate based on criteria filtering of the source exception. For example check other exceptions of this user in that timeframe or check if other users had the same issue (called “Problem”). This way you can get the context why the errors happened so you can fix it easily.
Nice but what is the Trend thing. Sound promising too.

Trends

The trends links open another Visual Studio panel which shows kind of a multidimensional cube with all possible data about request, responses, errors, performance, etc. One can again filter, group, sort, visualise them in many possible ways – just as you would except from a cube. All straight within Visual Studio just two clicks away from your actual code! The following screenshot show some of the options.

You can query all possible things – again using request and application data. You have a ton of options. To make the start with that Cube a little easier there are pre-build queries one can click and get the cube pre-configured:

image11

Azure Portal Integration

The Application Insights are nicely integrated into the Azure Portal. So one can query things from outside of Visual Studio within any web-browser:

Application Insights Portal

If you are a real hardcore analytic you may like to get even more query options. So you can point your web-browser to the Application Insight Portal and get the full blown thing. Here you can even write your own queries:

And did you hardcore analytics see the ultimate hard-core option: “Export to PowerBI“. Have fun!

Downside of Application Insight

Yes, there is a downside. More exactly there are two downsides:

  1. There is no on-prem version – it’s cloud-only.
  2. At the time writing this Application Insight Data can only be hosted in the U.S. No option to host it at least on continental europa.

This means you need to closely consider privacy for each of you apps, project and customer. For me these two options are a no-go for at least half of the projects/customers.

Integration options for your App

You can integration the collecting of Application Insight data in more then one way.

Every web-application can include a Application Insight Javascript and collect data via browsers. As this is a simple option and open for all kind of web-apps it can not collect server-inside data.

For this you can use the Application Insight SDK on the server and log your stuff. If you are a ASP.Net developer Microsoft has the option already in the stack and you just have to activate it. If you like to get more then the default data you can add SDK-Calls to your server-code too. Same for the client-code using their Javascript-SDK.

So far I didn’t explore the options for native-, desktop- and mobile-apps but I am pretty sure one can use the SDK and fire the log-requests from those platforms too.

Conclusion

Besides the obvious pros and cons it’s the first time I can watch my code to be alive when users are actively using it. Especially with the “Live” views it’s like you see your users using your software. It’s kind of feeling you software. Cool stuff. But there is the privacy side too. Sure it’s anonymized but somehow – especially the live-viewing – feels a little bit wrong to my Swiss culture. Maybe I just have to get used to it.

But all in all its cool tech and I like to explore it more when real usage data will come in.

marcd View All

I love to write software. More then two decades ago I managed to make my hobby my full-time job so I spent more then 20 year writing professional software (I guess that makes me a "Senior Software Developer"). The last few years I spend most of the time developing in C#/.Net for all kind of windows-, web- and embedded-software.

In my free time I enjoy my family, taking photos and go diving in cold lakes and rivers in Switzerland.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: