使用Spring Actuator + Micrometer + Prometheus + Grafana监控Spring Boot应用程序

前言

读取本文需要的知识:Java,Docker基本命令

当某个应用在生产环境中运行时,监控其运行状态是必要的和明智的。通过实时了解应用程序的运行状况,你能在问题出现之前得到警告,也可以在客户端注意到问题之前解决问题。

最终的效果图

使用Spring Actuator + Micrometer + Prometheus + Grafana监控Spring Boot应用程序_第1张图片

模块简单介绍

Spring Actuator:在应用程序离提供众多Web接口,通过它们了解应用运行时的内部状况。

Micrometer:为Java平台上的性能数据收集提供了一个通用的API,它提供了多种度量指标类型,同时支持接入 Influxdb,Graphite,Prometheus等。

Prometheus:一个时间序列数据库,用于收集指标。

Grafana:数据可视化工具。

下面是数据流向

使用Spring Actuator + Micrometer + Prometheus + Grafana监控Spring Boot应用程序_第2张图片

创建示例应用

首先要创建可以监控的Spring Boot监控程序,并添加Spring Boot Actuator,Prometheus,Spring Boot Web依赖


    org.springframework.boot
    spring-boot-starter-actuator

你可能感兴趣的:(java,docker)