Operations 7 min read

How to Deploy and Use Elastic APM for Full-Stack Performance Monitoring

This guide explains Elastic APM’s architecture—including agents, server, Elasticsearch, and Kibana—provides step‑by‑step instructions for deploying the APM server with Docker, configuring it, installing agents for various languages, and visualizing performance data in Kibana, enabling developers to monitor and troubleshoot application latency and errors.

Programmer DD
Programmer DD
Programmer DD
How to Deploy and Use Elastic APM for Full-Stack Performance Monitoring

Overview

Elastic APM is an application performance monitoring system built on the Elastic Stack. It can monitor applications and collect detailed performance information such as request response times, database queries, cache calls, external HTTP requests, and automatically gather unhandled errors and exceptions, grouping them by stack trace.

APM Components

Elastic APM consists of four components:

APM agent : Open‑source libraries written in the same language as the service; they detect code at runtime, collect performance data and errors, buffer them briefly, and send them to the APM server.

APM server : A Go‑based open‑source service that listens on port 8200, receives data from agents via a JSON HTTP API, and stores the documents in Elasticsearch.

Elasticsearch : A highly scalable open‑source search and analytics engine used to store APM metrics and enable aggregation.

Kibana : An open‑source visualization platform that works with Elasticsearch to display APM data.

Deploy APM Server

1. Deploy Elasticsearch and Kibana

Reference: Deploy Elasticsearch with Docker and enable authentication.

2. Edit the APM server configuration file apm-server.yml

apm-server:
  host: "0.0.0.0:8200"

output.elasticsearch:
  hosts: ["elasticsearch:9200"]
  username: "admin"
  password: "Passw0rd"
More configuration options are documented in the official APM Server config guide.

3. Deploy the APM server

docker run -d \
  --name apm-server \
  --link elasticsearch:elasticsearch \
  -v `pwd`/apm-server.yml:/usr/share/apm-server/apm-server.yml \
  -p 8200:8200 \
  -e "TZ=Asia/Shanghai" \
  docker.elastic.co/apm/apm-server:6.6.2
Reference: Running APM Server on Docker.

APM Agent Support

The APM agent currently supports the following languages and frameworks:

Java – Servlet API, Spring MVC, Spring Boot

Node.js – Express, hapi, Koa, Restify

Go – Gorilla, Gin

Python – Django, Flask

Ruby – Rails

RUM (Real User Monitoring) – browser‑side interaction capture

Reference: Installation and configuration of APM agents.

Example: Spring Boot & APM Agent

1. Download the Java agent library

Download URL: https://search.maven.org/search?q=a:elastic-apm-agent

2. Start the Spring Boot application with the agent

java \
  -javaagent:/path/to/elastic-apm-agent-<version>.jar \
  -Delastic.apm.service_name=my-cool-service \
  -Delastic.apm.application_packages=org.example,org.another.example \
  -Delastic.apm.server_urls=http://localhost:8200 \
  -jar <app-name>.jar

Successful startup logs indicate the agent is connected to the APM server.

2019-03-24 18:29:49.027 [apm-server-healthcheck] INFO co.elastic.apm.agent.report.ApmServerHealthChecker - Elastic APM server is available: {"ok":{"build_date":"2019-03-06T14:11:42Z","build_sha":"daad5449d758e7bf101f6482778a2b15f646a67f","version":"6.6.2"}}
2019-03-24 18:29:49.215 [main] INFO co.elastic.apm.agent.configuration.StartupInfo - Starting Elastic APM 1.4.0 as my-application on Java 1.8.0_172 (Oracle Corporation) Mac OS X 10.14.3
...

3. Access the Spring Boot service URLs

http://localhost:8080/

http://localhost:8080/user

Kibana APM Dashboard

Kibana URL: http://localhost:5601

Login credentials: admin / Passw0rd After logging in, the APM dashboards display service lists, request metrics, and error statistics.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

JavaDockerElasticsearchPerformance MonitoringKibanaelastic apm
Programmer DD
Written by

Programmer DD

A tinkering programmer and author of "Spring Cloud Microservices in Action"

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.