在以前的文章中,我们介绍了Spring Micrometer和InfluxDB。 所以你要问我为什么普罗米修斯。
原因是Prometheus在InfluxDB的拉模型与推模型上进行操作。

这意味着,如果将千分尺与InfluxDB一起使用,则在将结果推送到数据库中时肯定会有一些开销,并且使InfluxDB数据库始终可用于处理所有请求是一个额外的痛苦点。


那么,如果不是推送数据而是使用其他工具从应用程序中提取数据怎么办?
这是使用Prometheus可以获得的东西之一。 通过使用普罗米修斯,您可以从应用程序中请求数据,而不必接收数据。

因此,我们要做的是使用与第一个教程完全相同的项目。

所需的唯一更改应在applicaiton.yaml以及pom.xml上

我们将从pom.xml开始,并为prometheus添加千分尺二进制。

 <? xml version = "1.0" encoding = "UTF-8" ?>  < project xmlns = " http://maven.apache.org/POM/4.0.0 " xmlns:xsi = " http://www.w3.org/2001/XMLSchema-instance " xsi:schemaLocation = " http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd " > < modelVersion >4.0.0</ modelVersion > < parent > < groupId >org.springframework.boot</ groupId > < artifactId >spring-boot-starter-parent</ artifactId > < version >2.2.4.RELEASE</ version > </ parent > < groupId >com.gkatzioura</ groupId > < artifactId >spring-prometheus-micrometer</ artifactId > < version >1.0-SNAPSHOT</ version > < properties > < micrometer.version >1.3.2</ micrometer.version > </ properties > < build > < defaultGoal >spring-boot:run</ defaultGoal > < plugins > < plugin > < groupId >org.apache.maven.plugins</ groupId > < artifactId >maven-compiler-plugin</ artifactId > < configuration > < source >8</ source > < target >8</ target > </ configuration > </ plugin > < plugin > < groupId >org.springframework.boot</ groupId > < artifactId >spring-boot-maven-plugin</ artifactId > </ plugin > </ plugins > </ build > < dependencies > < dependency > < groupId >org.springframework.boot</ groupId > < artifactId >spring-boot-starter-webflux</ artifactId > </ dependency > < dependency > < groupId >org.springframework.boot</ groupId > < artifactId >spring-boot-starter-actuator</ artifactId > </ dependency > < dependency > < groupId >io.micrometer</ groupId > < artifactId >micrometer-core</ artifactId > < version >${micrometer.version}</ version > </ dependency > < dependency > < groupId >io.micrometer</ groupId > < artifactId >micrometer-registry-prometheus</ artifactId > < version >${micrometer.version}</ version > </ dependency > < dependency > < groupId >org.projectlombok</ groupId > < artifactId >lombok</ artifactId > < version >1.18.12</ version > < scope >provided</ scope > </ dependency > </ dependencies >  </ project > 

然后,我们将添加启用prometheus的application.yaml。

管理:
端点:
网络: 接触: 包括:普罗米修斯

现在,我们准备运行该应用程序。

 > mvn spring-boot:run 

如果我们尝试访问执行器,我们将看到普罗米修斯端点。

 > curl http: //localhost:8080/actuator  { "_links" : { "self" : { "href" : " http://localhost:8080/actuator " , "templated" : false }, "prometheus" : { "href" : " http://localhost:8080/actuator/prometheus " , "templated" : false } }  } 

这个“ http:// localhost:8080 / actuator / prometheus&#8221 ; 是我们的prometheus服务器用来提取数据的端点。
因此,我们的prometheus服务器需要配置为访问该端点公开的这些数据。

在下一个博客中,我们将部署Prometheus并查看一些指标。

翻译自: https://www.javacodegeeks.com/2020/05/spring-boot-and-micrometer-with-prometheus-part-4-the-base-project.html

带Prometheus的Spring Boot和测微表第4部分:基础项目相关推荐

  1. 带有Prometheus的Spring Boot和测微表第6部分:保护指标

    以前,我们使用Prometheus成功启动了Spring Boot应用程序. Spring应用程序中的一个端点正在公开我们的指标数据,以便Prometheus能够检索它们. 想到的主要问题是如何保护此 ...

  2. spring boot自测_将测微仪与Spring Boot 2一起使用

    spring boot自测 这是快速入门,介绍了如何使用出色的Micrometer库来检测基于Spring Boot 2的应用程序并在Prometheus中记录指标 介绍 Micrometer在不同监 ...

  3. Spring Boot+gRPC构建微服务并部署到Istio(详细教程)

    点击关注公众号,实用技术文章及时了解 作为Service Mesh和云原生技术的忠实拥护者,我却一直没有开发过Service Mesh的应用.正好最近受够了Spring Cloud的"折磨& ...

  4. 基于spring boot的邮件微服务消息中间件设计与实现 毕业论文+系统功能图v1.0.vsdx+项目源码

    下载地址:https://download.csdn.net/download/m0_63680064/36065411 项目介绍: 基于spring boot的邮件微服务消息中间件设计与实现 毕业论 ...

  5. 五分钟学会 Spring Boot Admin:微服务应用监控(小白必看,一看就会教程)

    Spring Boot Admin:微服务应用监控 Spring Boot Admin 简介 监控信息演示 结合注册中心使用 功能演示 添加登录认证 文末福利 Spring Boot Admin 可以 ...

  6. Spring Boot JPA中关联表的使用

    文章目录 添加依赖 构建Entity 构建Repository 构建初始数据 测试 Spring Boot JPA中关联表的使用 本文中,我们会将会通过一个Book和Category的关联关系,来讲解 ...

  7. Spring Boot Admin:微服务应用监控

    摘要 Spring Boot Admin 可以对SpringBoot应用的各项指标进行监控,可以作为微服务架构中的监控中心来使用,本文将对其用法进行详细介绍. Spring Boot Admin 简介 ...

  8. 基于Spring Boot+Cloud构建微云架构

    链接:my.oschina.net/u/3636867/blog/1802517 前言 首先,最想说的是,当你要学习一套最新的技术时,官网的英文文档是学习的最佳渠道.因为网上流传的多数资料是官网翻译而 ...

  9. 基于 Spring Boot + Cloud 构建微云架构

    点击上方"Java基基",选择"设为星标" 做积极的人,而不是积极废人! 源码精品专栏 原创 | Java 2019 超神之路,很肝~ 中文详细注释的开源项目 ...

最新文章

  1. 常见apk安装失败的错误及原因
  2. 3G时代需要“移动云计算专业”
  3. mysql 返回最大值列名_多列求最大值列和列名
  4. FIFO and DMA
  5. gin context和官方context_Gin框架系列01:极速上手
  6. 电流源并联怎么合并_一种特殊的并联切换电力系统,长见识了
  7. Eigen(2) 模块与头文件
  8. Easyui中使用jquery或js动态添加元素时出现的样式失效的解决方法
  9. hibernate之初学复合主键
  10. flutter 点击旋转动画_flutter RotationTransition实现旋转动画
  11. 思科交换机接口配置trunk_思科交换机配置TRUNK的主要步骤
  12. 无线传感器网络MAC协议(下)
  13. TFIDF理解和应用
  14. 男性平均寿命要比女性短5至10年
  15. Rockchip | Rockchip Kernel的获取与构建
  16. 生物素PEG叠氮,Biotin-PEG-Azide,N3-PEG-Biotin
  17. Echarts地图自定义图标Symbol同时动态更改图标进行切换显示
  18. GYM 100827 I.Salary Inequity(线段树)
  19. 如何 修炼 软件测试这门 手艺
  20. 吞食天地2刘蜀传攻略

热门文章

  1. nssl1232-函数【数论,欧拉函数,莫比乌斯反演】
  2. 线段树-Count on a Treap-神题
  3. JS中typeof的用法
  4. select count(*)底层究竟干了啥么?
  5. Java IO: RandomAccessFile
  6. Jdk1.8 JUC源码增量解析(2)-atomic-LongAdder和LongAccumulator
  7. java程序员被误导的一个概念,Set也可以有序
  8. FileInputStream
  9. Spring Boot中mapper包所放位置的配置
  10. “老师,请您多关注一下我吧!!!”