à悟空学院:https://t.cn/Rg3fKJD
学院中有Spring Boot相关的课程!点击「阅读原文」进行查看!
SpringBoot视频:http://t.cn/A6ZagYTi
Spring Cloud视频:http://t.cn/A6ZagxSR
SpringBoot Shiro视频:http://t.cn/A6Zag7IV
SpringBoot交流平台:https://t.cn/R3QDhU0
SpringData和JPA视频:http://t.cn/A6Zad1OH
SpringSecurity5.0视频:http://t.cn/A6ZadMBe
Sharding-JDBC分库分表实战:http://t.cn/A6ZarrqS
分布式事务解决方案「手写代码」:http://t.cn/A6ZaBnIr
网易云课堂视频最新更新:
第十一章 Spring Boot 日志
1、spring boot日志—理论
2、Spring Boot日志-logback
3、Spring Boot日志-log4j2
第十二章 Spring Boot 知识点2
1、spring boot 服务配置和部署
2、Spring Boot 定制URL匹配规则
【本文章是否对你有用以及是否有好的建议,请留言】
spring-boot-actuator模块提供了一个监控和管理生产环境的模块,可以使用http、jmx、ssh、telnet等拉管理和监控应用。审计(Auditing)、
健康(health)、数据采集(metrics gathering)会自动加入到应用里面。
首先,写一个最基本的spring boot项目。
基于Maven的项目添加‘starter’依赖:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
以下是所有监控描述:
HTTP方法 |
路径 |
描述 |
鉴权 |
GET |
/autoconfig |
查看自动配置的使用情况,该报告展示所有auto-configuration候选者及它们被应用或未被应用的原因 |
true |
GET |
/configprops |
显示一个所有@ConfigurationProperties的整理列表 |
true |
GET |
/beans |
显示一个应用中所有Spring Beans的完整列表 |
true |
GET |
/dump |
打印线程栈 |
true |
GET |
/env |
查看所有环境变量 |
true |
GET |
/env/{name} |
查看具体变量值 |
true |
GET |
/health |
查看应用健康指标 |
false |
GET |
/info |
查看应用信息 |
false |
GET |
/mappings |
查看所有url映射 |
true |
GET |
/metrics |
查看应用基本指标 |
true |
GET |
/metrics/{name} |
查看具体指标 |
true |
POST |
/shutdown |
允许应用以优雅的方式关闭(默认情况下不启用) |
true |
GET |
/trace |
查看基本追踪信息 |
true |
health
比如:http://localhost:8080/health
你可以得到结果
{
status: "UP",
diskSpace: {
status: "UP",
total: 107374174208,
free: 14877962240,
threshold: 10485760
}
}
可以检查的其他一些情况的健康信息。下面的HealthIndicators会被Spring Boot自动配置:
DiskSpaceHealthIndicator 低磁盘空间检测
DataSourceHealthIndicator 检查是否能从DataSource获取连接
MongoHealthIndicator 检查一个Mongo数据库是否可用(up)
RabbitHealthIndicator 检查一个Rabbit服务器是否可用(up)
RedisHealthIndicator 检查一个Redis服务器是否可用(up)
SolrHealthIndicator 检查一个Solr服务器是否可用(up)
自定义当然也可以,你可以注册实现了HealthIndicator接口的Spring beans,Health响应需要包含一个status和可选的用于展示的详情。
import org.springframework.boot.actuate.health.HealthIndicator;
import org.springframework.stereotype.Component;
@Component
public class MyHealth implements HealthIndicator {
@Override
public Health health() {
int errorCode = check(); // perform some specific health check
if (errorCode != 0) {
return Health.down().withDetail("Error Code", errorCode).build();
}
return Health.up().build();
}
}
trace
访问http://localhost:8080/trace 可以看到结果,默认为最新的一些HTTP请求
info
当执行 http://localhost:8080/info 的时候,结果什么没有
但是,在application.properties加入一些配置
info.app.name=ecs
info.app.version=1.0.0
info.build.artifactId=@project.artifactId@
info.build.version=@project.version@
执行/info就可以看到有些信息了。
/info 是用来在构建的时候,自动扩展属性的。对于Maven项目,可以通过 @..@ 占位符引用Maven的’project properties’。
更多的细节和探索,需要自己看看源码和spring boot的官方文档。
à悟空学院:https://t.cn/Rg3fKJD
学院中有Spring Boot相关的课程!点击「阅读原文」进行查看!
SpringBoot视频:http://t.cn/A6ZagYTi
Spring Cloud视频:http://t.cn/A6ZagxSR
SpringBoot Shiro视频:http://t.cn/A6Zag7IV
SpringBoot交流平台:https://t.cn/R3QDhU0
SpringData和JPA视频:http://t.cn/A6Zad1OH
SpringSecurity5.0视频:http://t.cn/A6ZadMBe
Sharding-JDBC分库分表实战:http://t.cn/A6ZarrqS
分布式事务解决方案「手写代码」:http://t.cn/A6ZaBnIr
相关推荐
从零开始学Spring Boot.pdf从零开始学Spring Boot.pdf从零开始学Spring Boot.pdf从零开始学Spring Boot.pdf从零开始学Spring Boot.pdf从零开始学Spring Boot.pdf从零开始学Spring Boot.pdf从零开始学Spring Boot.pdf...
从零开始学Spring Boot,没有...(15)Spring Boot使用Druid和监控配置【从零开始学Spring Boot】 http://412887952-qq-com.iteye.com/blog/2292362 16)Spring Boot使用Druid(编程注入)【从零开始学Spring Boot】 ...
NULL 博文链接:https://412887952-qq-com.iteye.com/blog/2299732
NULL 博文链接:https://412887952-qq-com.iteye.com/blog/2293846
NULL 博文链接:https://412887952-qq-com.iteye.com/blog/2299777
NULL 博文链接:https://412887952-qq-com.iteye.com/blog/2292739
从零开始学Spring Boot。是学习spring Boot的起步资料!!
NULL 博文链接:https://412887952-qq-com.iteye.com/blog/2295146
NULL 博文链接:https://412887952-qq-com.iteye.com/blog/2292362
NULL 博文链接:https://412887952-qq-com.iteye.com/blog/2291500
NULL 博文链接:https://412887952-qq-com.iteye.com/blog/2317365
NULL 博文链接:https://412887952-qq-com.iteye.com/blog/2305992
NULL 博文链接:https://412887952-qq-com.iteye.com/blog/2292476
NULL 博文链接:https://412887952-qq-com.iteye.com/blog/2328358
NULL 博文链接:https://412887952-qq-com.iteye.com/blog/2292388
从零开始学Spring Boot(Spring Boot技术文档)
从零开始学springboot 适合小白学习 spring全家桶系列