Monitor a Service with Elastic APM

Hilal Demir
Testinium
Published in
3 min readApr 6, 2021

What is Elastic APM?

Elastic APM is an application performance monitoring system built on the Elastic Stack. It allows you to monitor software services and applications in real-time, by collecting detailed performance information on response time for incoming requests, database queries, calls to caches, external HTTP requests, and more.

Elastic APM consists of four components: APM agents, APM Server, Elasticsearch, and Kibana.

In this article, I will explain how to setup Elastic APM and install agents to monitor any service using Elastic Cloud which comes with the latest versions of the components above.

Step 1: Set Up APM with Elastic Cloud

First of all, you need to sign up to Elastic Cloud. You can get a free trial as a start (there is no need for credit card). After, click Create Deployment and select Elastic Observability and give a name for your deployment. After you created, it will give you an elastic username and password. You can copy and save your password. Then, select APM and it will give your APM endpoint and secret token you will need. It is as easy as it is.

Step 2: Install Agent

To monitor a service, you will need the according agent. Agents need to be same language as your service. You can choose the appropriate agent you want to use, I installed the Java Agent due to the service I want to monitor.

Step 3: Start Your Application

You can start your application with -javaagent flag and with application’s jar:

java -javaagent:/path/to/elastic-apm-agent-<version>.jar \
-Delastic.apm.service_name=my-application \
-Delastic.apm.server_urls=http://localhost:8200 \
-Delastic.apm.secret_token= \
-Delastic.apm.application_packages=org.example \
-jar my-application.jar

It should look something like this:

java -javaagent:/Users/hilaldemir/Downloads/elastic-apm-agent-1.22.0.jar \
-Delastic.apm.service_name=my-application \
-Delastic.apm.server_urls=https://observability-deployment-******.apm.us-west1.gcp.cloud.es.io/ \
-Delastic.apm.secret_token= V*******\
-Delastic.apm.application_packages=com.qadashboard \
-jar qa-dashboard.jar

After running this command, it should start your application with the java agent you installed. Now, it should have started to monitor your application metrics :)

You can make advanced configuration whenever you want with the console. The changes will be automatically mirrored to the apm-server.yml file.

Step 4: Monitor Your Results

Finally, you can monitor your service in the APM app in Kibana which allows you to see the visualized metrics of your service. You can access the Kibana server by logging into your Elastic Cloud account and launching the Kibana endpoint in your deployment whenever you want. Your APM metrics are right under the Observability>APM :)

To have an insight, it looks like this:

I can say that Elastic Cloud made our work lot easier than before :)

If you want to add these metrics to your dashboard and track your production performance including data from different environments, you can use Oobeya. Additionally, Oobeya helps you to get complete visibility of your software’s health, track quality-related metrics and enlighten the engineering process.

It will help you to build a high-performing technology organization. :)

--

--

Testinium
Testinium

Published in Testinium

Testinium’s open-source based, enterprise ready platform unifies all the functionality you need to shift testing left — and right.

Hilal Demir
Hilal Demir