Grafana - Neethahiremath/Wiki GitHub Wiki
Time Series DB:
A time series database is a software system that is optimised for storing and serving time series through associated pairs of time and value. In some fields, time series may be called profiles, curves, traces or trends.
Telegraf: is a plugin-driven server agent for collecting & reporting metrics, and is the first piece of the TICK stack. ... It also has output plugins to send metrics to a variety of other datastores, services, and message queues, including InfluxDB, Graphite, OpenTSDB, Datadog, Librato, Kafka, MQTT, NSQ, and many others.
Prometheus: is a time-series database that stores our metric data by pulling it (using a built-in data scraper) periodically over HTTP. The intervals between pulls can be configured, of course, and we have to provide the URL to pull from. It also has a simple user interface where we can visualize/query on all of the collected metrics.
Micrometer: To solve this problem of being a vendor-neutral data provider, Micrometer came to be. It exposes Actuator metrics to external monitoring systems such as Prometheus, Netflix Atlas, AWS Cloudwatch, and many more. Just as a refresher, SLF4J is a logging facade for other Java logging frameworks. SLF4J itself does not have any logging implementation. The idea is that you write code using SLF4J API's and the real implementation of it comes from the framework you choose. It could be any of the popular frameworks like log4j, logback, etc.
Grafana: Visualizes our data in graphs. Grafana can pull data from various data sources like Prometheus, Elasticsearch, InfluxDB, etc. It also allows you to set rule-based alerts, which then can notify you over Slack, Email, Hipchat, and similar.
Prometheus Query Language - PromQL Another thing to note is - Prometheus has its own query language called PromQL. It allows the user to select and aggregate time series data in real-time, storing it either in graph or tabular format. Alternatively, you can feed it to an external API through HTTP.
refer:
https://stackabuse.com/monitoring-spring-boot-apps-with-micrometer-prometheus-and-grafana/
spring boot actuators exposes matrix and we can use it with end points, this is not user friendly and difficult to find out the matrix. we could use spring admin but it is less popular and has its own limitations.
in pom add the
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-prometheus</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-core</artifactId>
<version>1.1.1</version>
</dependency>
in yml add
management:
endpoints:
web:
base-path: /actuator
exposure:
include: ["configprops", "env", "metrics", "prometheus", "health", "info", "threaddump"]
info:
git:
mode: full
metrics:
enabled: true
export:
prometheus:
enabled: true
web:
server:
auto-time-requests: false
distribution:
percentiles:
all: 0.7, 0.95
prometheus:
enabled: true
Monitoring an application's health and metrics helps us manage it better, notice unoptimized behavior, and better understand 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 used Micrometer to reformat the metrics data provided by Spring Boot Actuator and expose it in a new endpoint. This data was then regularly pulled and stored by Prometheus, which is a time-series database. Ultimately, we've used Grafana to visualize this information with a user-friendly dashboard.