Today I wanted to learn a new Azure workload called “Visual Studio Application Insights.” I have read a lot about but, but never used it. Application Insights is a Azure workload that provides performance analytics of your application. With Application Insights (AI) you should be able to detect and diagnose performance issues. AI uses machine learning to know the default behavior of your application/website. With that knowledge it is able to detect changes in the performance.

Since I got a WordPress website that is not monitored at all, I wanted to integrate Application Insights with WordPress, so I can monitor the performance this blog.

Creating an Application Insights workspace in Azure

Let’s start by creating an Application Insights workspace. In the Azure Portal add “Application Insights” to your subscription. Below you can find a screenshot with the settings I used. Since WordPress is not a .NET or Java application, I had to use “Other (preview)” as application type. After clicking on create, Azure is going to deploy your workspace.


Integrate Application Insights with WordPress

This is probaly the most easy part of everything you have to do. In the “plugin store” of WordPress is a plugin available called “Application Insights.” You should install this plugin, and activate it.


The next step is to configure the plugin. You need to enter the instrumentation key. When you created your AI workspace, Microsoft generated a instrumentation key. You can find this key in the properties of your AI workspace.


You should copy that key, and paste it in the configuration of the WordPress plugin


After saving the changes of the wordpress plugin, AI is active. You can check it by viewing the source of your WordPress website. You can find the following code snippet in the source:

With a couple of minutes, the first graphs were visible:


Setting up web tests

To check the availability of your website, Application Insights provides web tests. Web tests are tests that will be executed in selected Microsoft datacenters to check the availability of your website. There are two types of test that you can setup:

  • URL Ping test – this test “pings” the URL you enter and checks for a specific HTTP response (normally 200)
  • Multi-step tests – this test are actually Visual Studio Web tests. With these tests you are able to navigate through the website and check on more than only HTTP responses (e.g. HTML snippets).

In the case of my WordPress website, I use a URL Ping tests. I used the following configuration for this test:


As you can see alerts will only be generated if 3/4 locations fails within 5 minutes. So when one location has a failure, I don’t get an alert. I do this to exclude routing problems in alerts. When 3 locations are testing successfully and one fails; it’s safe to say that there is a routing/network problem with the failing location.

Since my application is hosted in Europe, I changed the default test locations. When you click on create, the web tests are saved. After waiting a couple of minutes; the first tests are executed:



In this post I showed you how to integrate Visual Studio Application Insights with WordPress. As you can see, the integration is quite easy to do. After doing the integration you have to configure web tests to check the availability of your website. All installation and configuration was done without any downtime of my application. This means that you can integrate Application Insights without using the maintenance window of your application.

Expect a new blogpost in a couple of days about alert rules and the multi-step tests. If you have any questions, feel free to leave a comment.


After writing this post and clicking around in Application Insights I noticed that the average response time of this website is about 5 seconds. That is a little bit long… (the website was hosted on a Azure A1 VM). I changed the site of the VM to A2. During the “upgrade” of my virtual machine, I received an alert in the Azure Portal that the application was not available. That proves that the availability tests are working!



Submit a Comment

Your email address will not be published. Required fields are marked *

Share This