当前位置:   article > 正文

Spring Boot 项目如何做性能监控?_springboot程序能耗实时检测

springboot程序能耗实时检测

Spring Boot特别适合团队构建各种可快速迭代的微服务,同时为了减少程序本身监控系统的开发量,Spring Boot 提供了 actuator 模块,可以很方便的对你的 Spring Boot 程序做监控。

1. actuator接口说明

Spring Boot 应用中加入监控很简单,只需要在pom.xml文件中加入以下依赖:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
  • 1
  • 2
  • 3
  • 4

为了保证actuator接口的敏感性,在配置文件中,开放安全属性配置:

management.security.enabled=false
  • 1

这样就能允许你查看 Spring Boot 进程的actuator信息了。

启动Spring Boot程序,在启动日志里看到可访问的actuator接口:
在这里插入图片描述
通过这些,我们可以实时的获取应用的各项监控指标。

actuator的接口分为原生接口和用户自定义接口。

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/article/detail/50083
推荐阅读
相关标签
  

闽ICP备14008679号