Grafana | Prometheus | How To Monitor A Microservice Using Grafana ? | InterviewDOT
Channel: Interview DOT
Date: 2020-02-08

Click here - https://www.youtube.com/channel/UCd0U_xlQxdZynq09knDszXA?sub_confirmation=1 to get notifications.

Grafana Prometheus - How To Monitor A Microservice - Spring REST Application Demo | InterviewDOT

Monitoring tool - Prometheus.
What is Grafana ?
Monitoring Spring Application Demo

Prometheus + Grafana is a common combination of tools to build up a monitoring system. In this tutorial, I’ll share how to get a dashboard by a tiny but complete example, which monitors how many requests are handled by a spring boot server

Introduction
Monitoring an application's health and metrics helps us manage it better, notice unoptimized behavior and get closer to its performance. This especially holds true when we're developing a system with many microservices, where monitoring each service can prove to be crucial when it comes to maintaining our system.

Based on this information, we can draw conclusions and decide which microservice needs to scale if further performance improvements can't be achieved with the current setup.

In this article, we'll cover how to monitor Spring Boot web applications. We will be using three projects to achieve this:

Micrometer: Exposes the metrics from our application
Prometheus: Stores our metric data

This might look like a lot, especially compared to just using the Spring Boot Actuator project, but it's very easy to implement all of them with just a few configurations.

To make things even easier, we'll be using Docker to run Prometheus 

One of the many great features of Spring Boot is the set of built-in actuators. These actuators provide an easy way to monitor and control just about every aspect of a Spring Boot application.

In this tutorial, we'll look at using the metrics actuator to create a self-hosted monitoring solution for Spring Boot applications.

The first part of monitoring Spring Boot applications is choosing a metrics database. By default, Spring Boot will configure a Micrometer metrics registry in every application.

This default implementation collects a pre-defined set of application metrics such as memory and CPU usage, HTTP requests, and a few others. But these metrics are stored in memory only, meaning they will be lost any time the application is restarted.

To create a self-hosted monitoring solution, we should first choose a metrics database that lives outside the Spring Boot application. The following sections will discuss just a few of the available self-hosted options.

Note that any time Spring Boot detects another metrics database on the classpath, it automatically disables the in-memory registry.

Prometheus is an open-source monitoring and alerting toolkit originally built at SoundCloud. It works slightly differently from InfluxDB.

Instead of configuring our application to publish metrics to Prometheus, we configure Prometheus to poll our application periodically.

This will create a new actuator endpoint that produces metrics data in a special format that Prometheus understands.

Next, we have to configure Prometheus to poll our application by adding our desired configuration into a prometheus.yml file.


https://github.com/net-vinothkumar/prometheus