In this lesson, you will learn about application monitoring, considered the most critical component of our instrumentation, using Azure Application Insights. We will talk about how application monitoring covers monitoring everything in our infrastructure including business logic, internally-developed software, and external libraries.
We will discuss adding Application Insights to your code prior to getting metrics.
You will see how Application Insights can be used to monitor applications running anywhere or on another provider.
We will show you how to install Application Insights on your system by creating the resources in the portal. Then, we will install the library in the application.
Now that we have a solid understanding of log analysis and system monitoring in Azure, we can proceed to the final and most critical component of our instrumentation: Application monitoring. This is a deeper level of monitoring that goes beyond just tracking the state of the hardware. When we talk about application monitoring, we really mean monitoring everything we actually put into our infrastructure - all of our own unique business logic, internally developed software, and external libraries.
The general way to do this is to use a monitoring library with your code. There are many such libraries as frameworks for different languages, such as dropwizard metrics or ERMA for Java. Application Insights is similar in that you will need to add it to your code base before you can start getting metrics. Like many such frameworks the library is pretty lightweight and should not cause much performance overhead. Tracking calls are non-blocking, batched, and sent in a separate thread.
Application Insights can be used to monitor applications running anywhere. You can use it to monitor applications hosted in another provider like AWS or Digital Ocean. You can use it to monitor applications hosted on premise or even on your personal computer. All that Azure needs is for your application to have the Insights library installed and sending metrics to an endpoint in Azure.
Now, the Azure Portal has some great quickstart guides for a few languages including Java, Node.js, and .Net. It starts by having you create the Application Insights resource in the portal. You will need to set an app name, a region, an application type (usually just the language or framework name), and a resource group name, which is just the name for the resource actually hosting the metric data.
Once you have the Application Insights resource defined, step two is installing the library in your app. The quickstart guide shows how to do this very quickly using an IDE like Eclipse. It can also be done manually if you carefully follow the Azure documentation. There are some useful code examples that show how to actually get your application code to send data.
Once you have solid application and system monitoring in place, you need to make use of all that data. You need to empower your systems to send you actionable alerts when metrics suggest that something is wrong. In the next lesson we will discuss how to create meaningful alerts using application and system metrics.
Jonathan Bethune is a senior technical consultant working with several companies including TopTal, BCG, and Instaclustr. He is an experienced devops specialist, data engineer, and software developer. Jonathan has spent years mastering the art of system automation with a variety of different cloud providers and tools. Before he became an engineer, Jonathan was a musician and teacher in New York City. Jonathan is based in Tokyo where he continues to work in technology and write for various publications in his free time.