Introduction to Elastic APM


preview imageDevOps
by Anurag Srivastava,Jan 7, 2020, 7:15:34 PM | 6 minutes |

Application Performance Monitoring (APM) is built on top of the Elastic Stack to monitor the application performance. APM is useful for the real-time monitoring of application and software services. It is quite simple to configure, as we only need to set up the APM agent for the application that we are using. As of now, the Elastic Stack supports APM agents for Java, .NET, Python's Django and Flask frameworks, RUM-JS, Node.js, Go, Ruby on Rails, Rack, and more. Once we configure the APM agent, it will start collecting various application-related information, such as HTTP requests, the response time for various requests, and database queries, and send this information to the APM Server. It also collects unhandled exceptions and errors; this is quite important information and using this, we can stabilize the application further.

If you want to learn more about monitoring then please refer to "Why monitoring is important?" blog. You may also like the blog on how to do "Log analysis with Elastic stack".

The default search provides us with a great way to drill down even further and get additional details. APM helps us to establish a full-stack monitoring system, where we can push the application performance metrics along with system logs, application logs, and database audit data into Elasticsearch. This way, after configuring the APM, we can access the end-to-end monitoring data that can show the complete details we need on a single dashboard. In this way, if something does go wrong, we can access the details of the issue by filtering through the time filter. I will cover Elastic APM in a series of blogs where I will cover APM configuration using APM agents for Python's Django framework.

APM components
APM consists of four main components that work together to monitor application performance. These components are as follows:

  • APM agents
  • The APM Server
  • Elasticsearch
  • Kibana

An APM agent can be configured as any other application agent which should be supported in the Elastic APM agent. Once the agent is configured, it will start capturing the application data and metrics and will send it to the APM Server. The APM Server then sends this data to a central Elasticsearch cluster for storage. Once the data is stored in Elasticsearch, we can view, search, and analyze it in the Kibana APM UI or on the dashboard. Take a look at the following screenshot to understand more about the architecture of these APM components:


The preceding screenshot shows the architecture of APM's components. Here, we have three APM agents that are connected to an APM Server and are sending application metrics and data to the APM Server. The APM Server is pushing the data to an Elasticsearch cluster from where Kibana collects this data to show it in the Kibana APM UI or a dashboard. Then, from the Kibana interface, we can view, search, and analyze the data. In this way, we can set up the APM components for monitoring application performance. Now, let's discuss each of the APM components in detail, starting with APM agents.

APM agents
Elastic APM agents are open source libraries that can be configured in Elastic supported languages and frameworks. They are built in the same native language that they support and that is why it is quite easy to configure them with the application. APM agents can be installed as a library in the same way that we install other libraries in any application. Once the APM agent is configured, it can be used to collect data, metrics, errors, and more from the application at runtime. The APM agent can buffer the data for some time and then send it to the APM Server. Currently, APM agents are supported for the following:

  • Go
  • Java
  • .NET
  • Node.js
  • Python
  • Ruby
  • Javascript

The APM Server
The APM Server is freely available with Elastic Stack and there is no need to purchase a license to set it up. It is written in the Go language and receives data from different APM agents that we can configure with the application. It listens to the default port 8200 and receives data in the form of JSON through the HTTP API. After receiving data from different agents, the APM Server groups them to create the documents that Elasticsearch can index, and then sends them to Elasticsearch. Elastic Stack uses the Beats framework in the background to create the APM Server and utilizes Beats' functionalities. The APM Server is a separate component that is usually installed on a dedicated machine. It sits between the APM agents and Elasticsearch and converts the data that it receives from the APM agents before sending it to Elasticsearch.

Elasticsearch
The APM Server sends metric and error data received from the APM agents to the Elasticsearch cluster. We can utilize the search and aggregation capabilities of Elasticsearch to analyze APM data. So, essentially, Elasticsearch stores all the APM data that can then be
analyzed or visualized in Kibana.

Kibana
We have two options in Kibana to visualize APM data. The first option is to use the dedicated APM UI that is available under the APM link in the left-hand side menu. The second option is to use the default Kibana dashboard, which is mainly used to visualize other data sources. We can visualize and search the APM performance metrics data in Kibana.

If you want to know how we can configure APM agents, APM server for Python Django, then refer to the blog on how we can configure the Django application with Elastic APM.


Other Blogs on Elastic Stack:

How to create Elasticsearch Cluster
Bucket Aggregation in Elasticsearch

Metrics Aggregation in Elasticsearch
Configure Logstash to push MySQL data into Elasticsearch 
Wildcard and Boolean Search in Elasticsearch
Elasticsearch Rest API
Basics of Data Search in Elasticsearch
Elasticsearch Rest API
Log analysis with Elastic stack 
Elasticsearch Installation and Configuration on Ubuntu 14.04
Introduction to Elasticsearch
Configure Logstash to push MongoDB data into Elasticsearch
Load CSV Data into Elasticsearch

In case of any doubt please leave your comments. You can also follow me on Twitter: https://twitter.com/anu4udilse

If you found this article interesting, then you can explore “Mastering Kibana 6.0”, “Kibana 7 Quick Start Guide”, “Learning Kibana 7”, and “Elasticsearch 7 Quick Start Guide” books to get more insight about Elastic Stack, how to perform data analysis, and how you can create dashboards for key performance indicators using Kibana.



Comments (0)

Leave a comment

Related Blogs

preview thumbnail
Introduction to Logstash

Dec 20, 2019, 11:38:31 AM | Anurag Srivastava

preview thumbnail
Importing MongoDB data into Elasticsearch

Mar 9, 2019, 8:20:38 AM | Anurag Srivastava

preview thumbnail
Importing MySQL data into Elasticsearch

Feb 9, 2019, 12:06:18 PM | Anurag Srivastava

preview thumbnail
Snapshot and Restore Elasticsearch Indices

Sep 16, 2019, 5:55:06 AM | Anurag Srivastava

preview thumbnail
Log analysis with Elastic stack

Jan 31, 2018, 6:11:29 AM | Anurag Srivastava

preview thumbnail
Creating Elasticsearch Cluster

Apr 6, 2019, 8:41:41 PM | Anurag Srivastava

Top Blogs

preview thumbnail
Configure SonarQube Scanner with Jenkins

Jun 21, 2018, 4:58:11 AM | Anurag Srivastava

preview thumbnail
Execute Commands on Remote Machines using sshpass

Jul 16, 2018, 5:00:02 PM | Anurag Srivastava

preview thumbnail
Importing MongoDB data into Elasticsearch

Mar 9, 2019, 8:20:38 AM | Anurag Srivastava

preview thumbnail
Importing MySQL data into Elasticsearch

Feb 9, 2019, 12:06:18 PM | Anurag Srivastava

preview thumbnail
Configure Jenkins for Automated Code Deployment

Jun 13, 2018, 3:44:01 PM | Anurag Srivastava

preview thumbnail
Deploying Angular code using Python script

Jun 26, 2018, 4:50:18 PM | Anurag Srivastava