Endpoint Monitoring with Azure Application Insights

Let's explore the use of Microsoft Azure Application Insights to monitor the health of our application using the endpoint /healthcheck.

Applications Insights it's a great tool for monitoring, error logging, performance monitoring, dependency mapping, and other things. In other words, it's a full APM - Application Performance Management - ready for you to use in Production Environments.

Application Insights, a feature of Azure Monitor, is an extensible Application Performance Management (APM) service for developers and DevOps professionals.
https://docs.microsoft.com/pt-br/azure/azure-monitor/app/app-insights-overview

💬 In this Issue

Recap of Previous Articles

This is the third article about Health Checks and Application Monitoring.

  1. Adding Health Check endpoint
  2. Adding UI Health Check
  3. Using Application Insights Endpoint Monitoring --> this article
  4. Using Azure App Services Endpoint Monitoring

Check the Prices Before Use in Production

Check out the prices before adopt in your work project.

Azure Pricing Page
Prices from https://azure.microsoft.com/en-us/pricing/details/monitor/

Check the latest updated prices at https://azure.microsoft.com/en-us/pricing/details/monitor/.

One Simple Requirement

Our API should be available over the internet (Application Insights should have access to hit it).

This article assumes that you have a Health Checks endpoint up and running available over the internet.

Go back to this article to set up and then return here.
The Health Check UI is not necessary for this article, only the API endpoint.

I published mine at https://webapphealthchecks.azurewebsites.net/
You can use it for testing purposes if you like.

Creating the Application Insights Resource

Access the Azure Portal at https://portal.azure.com and access the Application Insights blade and click Add to create a new resource.

Azure Portal with Application Insights Highlighted
Create Application Insights Resource

Enter all the required information to create the resource, such as subscription, resource group, etc.
When asked for the Resource Mode choose the Classic.

First Step to Create Application Insights Resource
Creating the AI

Once the Application Insights it's created, go to the Availability section.
This is where the monitoring tool is configured to watch our endpoint.

Application Insights Blade
Go to Availability

Now click on the +Add Test button.

Application Insights Creating Web Test
Adding Test

Fill in the required information.

  • Test name: AI-Ping-WebApp
  • Test Type: URL ping test
  • URL: https://webapphealthchecks.azurewebsites.net/healthcheck
  • Parse dependent requests: unchecked
  • Enable retries for availability test failures: checked
  • Test frequency: 5 minutes
  • Test locations: default values
  • Test Timeout: 120 seconds
  • HTTP Response: checked
  • Status code must equal: 200
  • Content match: checked
  • Content must contain: Healthy
  • Alerts: leave as default

And then Create.

Configure Application Insights Web Test
Configure Application Insights Web Test

The Results

Now just wait for the tests to begin and show the results. After a few minutes, you should get something like this.

Live Results
Line View Test Results
Scatter Plot Test Results
Scatter Plot Test Results

😎 Final thoughts

Wow, finally we made it. That is enough!

Of course, we can keep going adding more monitoring and making more use of Application Insights.

Share in the comments section what you would do to make it even better or different.

❤️ Enjoy this article?

Forward to a friend and let them know.

How was the tutorial?

Love Discord?