Overview: Expose Java application metrics using Micrometer
In a microservices architecture context, an application comprises numerous interconnected services collaborating seamlessly to deliver the necessary business functionality. Initially, implementing an application using a microservices architecture might seem straightforward. However, embarking on this path with precision is challenging, as it introduces complexities absent in a monolithic architecture.
One of these challenges is assessing system performance. Comprehending overall application health and promptly detecting anomalies are vital elements in maintaining a well-functioning microservices-based application. Monitoring plays a pivotal role in observing the application effectively.
Prometheus is one of the most popular tools today for collecting and recording these metrics and firing alarms in case of any violation, especially in containerized, cloud-native environments. It follows a pull-based model, scraping metrics data from designated targets regularly. These targets can be applications, services, databases, or other components that expose their metrics through HTTP endpoints.
Micrometer is a metrics instrumentation library designed for Java-based applications. It provides a simple and consistent way to instrument application code and collects various metrics so you can monitor your applications’ performance and behavior. The primary goal of Micrometer is to abstract away the differences between different monitoring systems and provide a unified API for capturing and reporting metrics. It supports integration with monitoring back-ends such as Prometheus, Grafana, InfluxDB, Datadog, New Relic, and more. This learning path will show you how to create a Quarkus application that uses the Micrometer library to expose metrics, and tie it into Prometheus for monitoring and alerts.
What you will do
In this learning path, you will:
- Create a Quarkus application.
- Deploy a Prometheus instance.
- Integrate with the Micrometer library.
What you will learn
When you have finished this learning path, you will understand:
- How to monitor Java applications.
- How to use the Developer Sandbox for Red Hat OpenShift.
- How to use the Prometheus open source monitoring system.
How long will this learning path take?
- Budget about 30 minutes to complete this activity.
What will I need to complete this learning path?
You will need:
- The
oc
command-line interface.
If you need help
If you get stuck, something isn’t working, or you simply have questions, contact us via email at devsandbox@redhat.com.
Next
Your first step in this learning path is to create a Quarkus application.