生活随笔
收集整理的這篇文章主要介紹了
springboot 增加prometeus监控
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
pom.xml 這兩個dep添加一下
<dependency><groupId>io.micrometer
</groupId><artifactId>micrometer-registry-prometheus
</artifactId></dependency><dependency><groupId>org.springframework.boot
</groupId><artifactId>spring-boot-actuator-autoconfigure
</artifactId></dependency>
controller增加一個path
@RestController
public class MoniterController {@GetMapping(value
= "/metrics")public void metrics(HttpServletResponse response
) throws IOException {response
.sendRedirect("/actuator/prometheus");}
}
application.yml增加一下配置
management:endpoints:web:exposure:include: '*'metrics:tags:application: $
{spring.application.name
}
在prometheus的yml中增加這個服務(wù)的配置查看prometheus的結(jié)果
總結(jié)
以上是生活随笔為你收集整理的springboot 增加prometeus监控的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。