Reader small image

You're reading from  Kibana 7 Quick Start Guide

Product typeBook
Published inJan 2019
PublisherPackt
ISBN-139781789804034
Edition1st Edition
Tools
Right arrow
Author (1)
Anurag Srivastava
Anurag Srivastava
author image
Anurag Srivastava

Anurag Srivastava is a senior technical lead in a multinational software company. He has more than 12 years' experience in web-based application development. He is proficient in designing architecture for scalable and highly available applications. He has handled development teams and multiple clients from all over the globe over the past 10 years of his professional career. He has significant experience with the Elastic Stack (Elasticsearch, Logstash, and Kibana) for creating dashboards using system metrics data, log data, application data, and relational databases. He has authored three other booksMastering Kibana 6.x, and Kibana 7 Quick Start Guide, and Learning Kibana 7 - Second Edition, all published by Packt.
Read more about Anurag Srivastava

Right arrow

Monitoring Applications with APM

Application Performance Monitoring (APM) is there to monitor application performance and is built on top of the Elastic Stack. APM is used to monitor application and software services in real time. We just need to configure the APM agent for the application, and after that the agent will collect and send various application-related information, such as HTTP requests, database queries, and the response time for the requests, to the APM server. Although many of the details we can get using browser developer tools, in Elastic APM we have many additional advantages: it also collects unhandled errors and exceptions, which is very important for application stability, and also the search option provides us an edge in pinpointing any issues. In this chapter, we will cover an introduction to and implementation of APM using a Django project.

APM, along with...

APM components

APM mainly consists of four different components, which work together to monitor the application. These components are as follows:

  • APM Agents
  • APM Server
  • Elasticsearch
  • Kibana

We can configure APM Agents as a library for an application, to send application metrics and data to the APM Server, from where data can be pushed to the Elasticsearch Cluster. Once data is pushed to Elasticsearch, we can view and analyze the data using the Kibana APM UI or Dashboard. Now, let's understand what each of these components does and how they can be configured with a different application:

In the preceding diagram, we have three APM Agents, which are sending data to a central APM Server, from where data is pushed to an Elasticsearch cluster, and then using Kibana, we can visualize and analyze this data through the APM UI or the Dashboard of Kibana.

...

Configure Django application with APM

I will take an example of an application for blog creation and listing API using Python Django framework. First, we have to install the APM agent for Python Django:

pip install elastic-apm

Then, we have to configure the agent with the Django application; we need to make the following changes in the settings.py file:

# Add the agent to the installed apps
INSTALLED_APPS = (
'elasticapm.contrib.django',
# ...
)

ELASTIC_APM = {
# Set required service name. Allowed characters:
# a-z, A-Z, 0-9, -, _, and space
'SERVICE_NAME': 'django application',

# Use if APM Server requires a token
'SECRET_TOKEN': 'mysecrettoken',

# Set custom APM Server URL (default: http://localhost:8200)
'SERVER_URL': 'http://localhost:8200',
}

# To send performance metrics, add our tracing middleware...

Summary

In this chapter, we covered Elastic APM and explained how we can monitor an application. We started with the APM components, which are APM Agents, APM Servers, Elasticsearch, and Kibana. After that, we covered each of them in detail. APM Agents are open source libraries that can be configured in any of the supported languages/libraries. Currently, we have support for Django and flask frameworks of Python, Java, Go, Node.js, Rails, Rack, RUM - JS, and Go. We can configure them to send application metrics and errors to APM Server. Then, we covered APM Server, which is again open source software, written in Go.

The main task of the APM Server is to receive data from different APM Agents and send it to the Elasticsearch Cluster. Elasticsearch takes the APM data, which can then be viewed, searched, or analyzed in Elasticsearch. Once data is pushed to Elasticsearch, we can display...

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Kibana 7 Quick Start Guide
Published in: Jan 2019Publisher: PacktISBN-13: 9781789804034
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Anurag Srivastava

Anurag Srivastava is a senior technical lead in a multinational software company. He has more than 12 years' experience in web-based application development. He is proficient in designing architecture for scalable and highly available applications. He has handled development teams and multiple clients from all over the globe over the past 10 years of his professional career. He has significant experience with the Elastic Stack (Elasticsearch, Logstash, and Kibana) for creating dashboards using system metrics data, log data, application data, and relational databases. He has authored three other booksMastering Kibana 6.x, and Kibana 7 Quick Start Guide, and Learning Kibana 7 - Second Edition, all published by Packt.
Read more about Anurag Srivastava