当前位置:
首页 >
具有InlfuxDB的Spring Boot和Micrometer第2部分:添加InfluxDB
发布时间:2023/12/3
48
豆豆
生活随笔
收集整理的这篇文章主要介绍了
具有InlfuxDB的Spring Boot和Micrometer第2部分:添加InfluxDB
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
自从我们添加了基本应用程序以来,是时候启动InfluxDB实例了。
我们将按照之前的教程进行操作,并添加一个docker实例。
docker run –rm -p 8086:8086 –name influxdb-本地influxdb
是时候在我们的pom上添加微米InfluxDB依赖项了
< dependencies > ... < dependency > < groupId >org.springframework.boot</ groupId > < artifactId >spring-boot-starter-actuator</ artifactId > </ dependency > < dependency > < groupId >io.micrometer</ groupId > < artifactId >micrometer-core</ artifactId > < version >1.3.2</ version > </ dependency > < dependency > < groupId >io.micrometer</ groupId > < artifactId >micrometer-registry-influx</ artifactId > < version >1.3.2</ version > </ dependency > ... </ dependencies >是时候通过application.yaml添加配置了
management: metrics: export: influx: enabled: true db: devjobsapi uri: http: / / 127.0 . 0.1 : 8086 endpoints: web: expose: "*" 让我们启动应用程序并执行一些请求。
一段时间后,我们可以检查数据库和其中包含的数据。
太棒了 让我们检查访问的端点。
> SELECT*FROM http_server_requests; name: http_server_requests time count exception mean method metric_type outcome status sum upper uri ---- ----- --------- ---- ------ ----------- ------- ------ --- ----- --- 1582586157093000000 1 None 252.309331 GET histogram SUCCESS 200 252.309331 252.309331 /actuator 1582586157096000000 0 None 0 GET histogram SUCCESS 200 0 2866.531375 /jobs/github/{page}太棒了! 下一步将是可视化那些指标。
翻译自: https://www.javacodegeeks.com/2020/02/spring-boot-and-micrometer-with-inlfuxdb-part-2-adding-influxdb.html
总结
以上是生活随笔为你收集整理的具有InlfuxDB的Spring Boot和Micrometer第2部分:添加InfluxDB的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: java batch_Java EE 7
- 下一篇: Spring Boot删除嵌入式Tomc