Application Insights – Part 7: Availability Monitoring and Web Testing with Application Insights
This series of blog posts will tell you everything you need to know about application insights.
Part 1: The Basics
Part 2: Is Application Insights really that “easy to add”?
Part 3: Is Application Insights really that “easy to use”?
Part 4: Application Monitoring with Application Insights
Part 5: Troubleshooting Failures with Application Insights
Part 6: Troubleshooting Performance Problems with Application Insights
Part 7: Availability Monitoring and Web-Testing with Application Insights
Part 8: Extending the Power of Application Insights with Glimpse and PowerBI
Part 7: Availability Monitoring and Web Testing with Application Insights
A feature that I like very much in Application Insights is “Availability Monitoring”. It allows you to configure web tests that are automatically executed in fixed time intervals and monitor the availability and responsiveness of your application. Application Insights currently supports two different types of tests, url ping tests and Visual Studio Web Tests. The tests can be scheduled and executed from a list of about 20 different locations around the globe. Activating sites in different countries gives you a great insight into the user experience that remote users will have. Once you have a set of tests defined, the results will be collected and shown in the availability dashboard.
Url Ping Test
This one is easy. You just define an url that needs to be called, set the interval to when you want it to be called and pick the locations from where it should be called.
With the test locations currently supported you will get a pretty good worldwide reach:
Creating Web Tests with Visual Studio and Fiddler
The Azure Portal allows you to upload a Visual Studio Web Test and execute it on a schedule and from several distant locations. A Visual Studio Web Test is basically a list of urls that are called one after another. This list of urls can then be enriched with verification information. An example would be to fail the test if a HTTP response code other than 200 has been received. In order for the test to decide if it was successful or failed, you can check for errors, HTTP return codes, response times or data in the response. Once the Web Test is completed it can be saved and uploaded to the Application Insights instance through the Azure Portal.
Visual Studio Web Test can either be written manually in Visual Studio or recorded using the Visual Studio Web Test Recorder. However, I would like to show you yet another really nice trick that only few people know about. Web Tests can be recorded using the free http proxy tool Fiddler from Telerik (https://www.telerik.com/download/fiddler). Just open Fiddler, go to your application in the browser and use your website. Fiddler will pick up all the requests and responses that went from your browser to your web server. In Fiddler, mark the requests that you are interested in and select “File –> Export Sessions –> Selected Sessions”. In the save as dialog, select “Visual Studio Web Test”. Then, open the saved file in Visual Studio and modify to your liking.
Once you are happy, save it and upload to the Azure Portal.
Monitoring the Availability
Clicking on the “Availiability” tile in the Azure Portal takes us to the availability overview that shows us a chart of all the successful and failed tests that have been executed in the time range and a line chart with the test duration over time.
Below the chart we can find the list of configured web tests. Clicking a test takes us to the test details. The test details present an overview on the test status and a geographic breakdown:
Selecting one of the tests takes you to the details of that specific tests:
From the details blade, you can download the web test results and open the file in Visual Studio. This allows you to take a look at the details of every request and response included in the web test results.
I really like how the loop is closed by creating a web test in Visual Studio, uploading it to the Application Insights Instance, letting it run on a schedule from different locations, downloading the results and analyzing them in Visual Studio!
Read on here: