What is Application Insights Anyway?
Application Insights is an extensible Application Performance Management (APM) service for web developers on multiple platforms. Use it to monitor your live web application. It will automatically detect performance anomalies. It includes powerful analytics tools to help you diagnose issues and to understand what users actually do with your app. (source: https://docs.microsoft.com/en-us/azure/application-insights/app-insights-overview)
I cannot stress powerful enough. You really get some significant tools to help you understand how your software is running and being utilized. Pricing isn’t bad either – all data is kept for 90 days, you get 5GB / month free and after that you pay something like 24,- NOK (USD $3.0) per additional GB of telemetry. It barely makes a dent in my Visual Studio Subscription at all!
Optimizations
So, today I added Application Insights (from here on: AI; not to be confused with artificial intelligence) to my Plants page that I’m working on. I wanted to figure out why the index page was taking a long time to load. Using Application Insights, I found the culprit in a matter of minutes! Here’s how I did it.
After adding AI to my project, I opened up the application map in the azure portal to see if I could figure out what was going on:
AI had already figured out that my solution basically consists of a Web Client, the Website itself, and a storage account. Magic!
I drilled into the client to get more details:
The option of showing what is going on in this call is named “What happens before and after”. Clicking on it shows me all the calls:
Fantastic, I immediately see that the calls highlighted in yellow are taking longer than I was comfortable with. Time to drill into the code and fix! Turns out, I should probably pre-cache my device locations and also add a short-duration cache to the calls to get device telemetry.
Conclusion
The simple act of adding AI to my project allowed me to immediately see and understand the spots in my code that were due for a makeover just by clicking around the metrics in the Azure portal.
Stay tuned for more as I explore this fantastic tool!
Useful links
- Azure Portal for adding a new Application insights instance to your webpage
- Application Insights “get started” page on Azure.com
- Visual Studio Homepage for downloading the most recent Visual Studio IDE.
Does it only work with Azure? I thought one was supposed to do this locally, too? No? Thanks
Sorry for the massively late reply, but yeah, Application Insights is Azure-only.