APM is an application performance monitoring system built on the Elastic Stack. It uses Elasticsearch as its data store and allows you to monitor software services and applications in real time. Regardless of whether your code is best described as a service or as an application, this guide will indiscriminately use the word service.
With APM you can automatically collect detailed performance information from inside your service with only minor changes to your code. For example APM agents can measure the response time for incoming requests, time spent in database queries, calls to caches, external HTTP requests, etc. This makes it easier to pinpoint and fix performance problems quickly.
APM also automatically collects errors and exceptions that are not handled by your service. Collected errors automatically get assigned a checksum based primarily on the stacktrace. This enables you to spot new errors as they appear and keep an eye on how many times specific errors happen.
Elastic APM consists of four components:
APM agents are open source libraries written in the same language as your service. You install them into your service as you would install any other library. The agents hook into your service and start collecting performance metrics and errors once it starts. All data collected by agents is buffered for a short period and sent on to APM Server. This happens once per minute, by default.
Out of the box, APM automatically instruments most popular web frameworks, database drivers, calls to caching servers, and HTTP libraries for requests to external services. Additionally, agents provide an API that you can use to manually instrument anything else you find interesting.
APM Server is an open source application written in Go which typically runs on dedicated servers. It listens on port 8200 by default and receives data from agents periodically through a JSON API. APM Server creates documents from the data received from agents and stores them in an Elasticsearch cluster.
To visualize the data after it’s sent to Elasticsearch, you can use the the dedicated APM UI bundled in X-Pack, or the pre-built open source Kibana dashboards that come with APM Server.
We designed Elastic APM to run on anything from a regular laptop to thousands of machines, and it’s easy to get started.