前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >专栏 >SpringCloud学习2-Springboot监控模块

SpringCloud学习2-Springboot监控模块

原创
作者头像
啦啦啦
修改于 2019-08-29 02:16:34
修改于 2019-08-29 02:16:34
46000
代码可运行
举报
运行总次数:0
代码可运行

学习一项新技术最大的困难是什么? 是资料。让人高兴的是找到了一本系统学习Spring Cloud的教程,《Spring Cloud微服务实战》, 接下来的学习目标将以此书顺序演进。

虽然Springboot 2.0刚刚发布,鉴于当下资料都是基于1.x的,对于初学者,站在前人的肩膀上会少踩坑。因此,接下来都将采用1.5.10.RELEASE

上一节,SpringCloud入门1-服务注册与发现(Eureka) 中已经尝试使用了spring-boot-starter-actuator模块中的健康检查端点,接下来将系统的学习该模块的功能。

Spring Boot includes a number of additional features to help you monitor and manage your application when it’s pushed to production. You can choose to manage and monitor your application using HTTP endpoints, with JMX or even by remote shell (SSH or Telnet). Auditing, health and metrics gathering can be automatically applied to your application.

引入

测试代码: https://github.com/Ryan-Miao/actuator-demo

如同上一节中所引入的方式一样。创建一个springboot项目,并添加依赖

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

actuator 美 ['æktʃʊˌeɪtə]

接下来,启动项目。

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
 .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::       (v1.5.10.RELEASE)

2018-03-04 12:15:52.611  INFO 18468 --- [           main] com.test.actuator.ActuatorApplication    : Starting ActuatorApplication on DESKTOP-4MOUU2Q with PID 18468 (D:\workspace\learn\springcloud\actuator-demo\target\classes started by Ryan in D:\workspace\learn\springcloud\actuator-demo)
2018-03-04 12:15:52.615  INFO 18468 --- [           main] com.test.actuator.ActuatorApplication    : No active profile set, falling back to default profiles: default
2018-03-04 12:15:52.709  INFO 18468 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@1efee8e7: startup date [Sun Mar 04 12:15:52 CST 2018]; root of context hierarchy
2018-03-04 12:15:55.125  INFO 18468 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
2018-03-04 12:15:55.140  INFO 18468 --- [           main] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
2018-03-04 12:15:55.140  INFO 18468 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.27
2018-03-04 12:15:55.265  INFO 18468 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
2018-03-04 12:15:55.265  INFO 18468 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2588 ms
2018-03-04 12:15:55.512  INFO 18468 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean  : Mapping servlet: 'dispatcherServlet' to [/]
2018-03-04 12:15:55.512  INFO 18468 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'metricsFilter' to: [/*]
2018-03-04 12:15:55.512  INFO 18468 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'characterEncodingFilter' to: [/*]
2018-03-04 12:15:55.512  INFO 18468 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
2018-03-04 12:15:55.512  INFO 18468 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'httpPutFormContentFilter' to: [/*]
2018-03-04 12:15:55.512  INFO 18468 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'requestContextFilter' to: [/*]
2018-03-04 12:15:55.512  INFO 18468 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'webRequestLoggingFilter' to: [/*]
2018-03-04 12:15:55.512  INFO 18468 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean   : Mapping filter: 'applicationContextIdFilter' to: [/*]
2018-03-04 12:15:55.926  INFO 18468 --- [           main] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@1efee8e7: startup date [Sun Mar 04 12:15:52 CST 2018]; root of context hierarchy
2018-03-04 12:15:56.004  INFO 18468 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2018-03-04 12:15:56.004  INFO 18468 --- [           main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-03-04 12:15:56.051  INFO 18468 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-03-04 12:15:56.051  INFO 18468 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-03-04 12:15:56.097  INFO 18468 --- [           main] o.s.w.s.handler.SimpleUrlHandlerMapping  : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-03-04 12:15:56.387  INFO 18468 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/env/{name:.*}],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EnvironmentMvcEndpoint.value(java.lang.String)
2018-03-04 12:15:56.387  INFO 18468 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/env || /env.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-03-04 12:15:56.387  INFO 18468 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/info || /info.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-03-04 12:15:56.387  INFO 18468 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/health || /health.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.HealthMvcEndpoint.invoke(javax.servlet.http.HttpServletRequest,java.security.Principal)
2018-03-04 12:15:56.387  INFO 18468 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/mappings || /mappings.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-03-04 12:15:56.387  INFO 18468 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/trace || /trace.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-03-04 12:15:56.387  INFO 18468 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/dump || /dump.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-03-04 12:15:56.403  INFO 18468 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/loggers/{name:.*}],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.LoggersMvcEndpoint.get(java.lang.String)
2018-03-04 12:15:56.403  INFO 18468 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/loggers/{name:.*}],methods=[POST],consumes=[application/vnd.spring-boot.actuator.v1+json || application/json],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.LoggersMvcEndpoint.set(java.lang.String,java.util.Map<java.lang.String, java.lang.String>)
2018-03-04 12:15:56.403  INFO 18468 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/loggers || /loggers.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-03-04 12:15:56.403  INFO 18468 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/autoconfig || /autoconfig.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-03-04 12:15:56.403  INFO 18468 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/metrics/{name:.*}],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.MetricsMvcEndpoint.value(java.lang.String)
2018-03-04 12:15:56.403  INFO 18468 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/metrics || /metrics.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-03-04 12:15:56.403  INFO 18468 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/auditevents || /auditevents.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public org.springframework.http.ResponseEntity<?> org.springframework.boot.actuate.endpoint.mvc.AuditEventsMvcEndpoint.findByPrincipalAndAfterAndType(java.lang.String,java.util.Date,java.lang.String)
2018-03-04 12:15:56.403  INFO 18468 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/configprops || /configprops.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-03-04 12:15:56.403  INFO 18468 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/beans || /beans.json],methods=[GET],produces=[application/vnd.spring-boot.actuator.v1+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.mvc.EndpointMvcAdapter.invoke()
2018-03-04 12:15:56.403  INFO 18468 --- [           main] o.s.b.a.e.mvc.EndpointHandlerMapping     : Mapped "{[/heapdump || /heapdump.json],methods=[GET],produces=[application/octet-stream]}" onto public void org.springframework.boot.actuate.endpoint.mvc.HeapdumpMvcEndpoint.invoke(boolean,javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) throws java.io.IOException,javax.servlet.ServletException
2018-03-04 12:15:56.512  INFO 18468 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2018-03-04 12:15:56.512  INFO 18468 --- [           main] o.s.c.support.DefaultLifecycleProcessor  : Starting beans in phase 0
2018-03-04 12:15:56.747  INFO 18468 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http)
2018-03-04 12:15:56.747  INFO 18468 --- [           main] com.test.actuator.ActuatorApplication    : Started ActuatorApplication in 4.615 seconds (JVM running for 5.11)

可以看到url mapping多了几个。接下来,分别看看这几个接口的内容。

访问这几个接口的时候发现啥也没有,然后看到控制台提示,这些敏感信息需要加密。所以,必须引入security模块。

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-security</artifactId>
</dependency>

设置用户名密码:

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
security.user.name=admin
security.user.password=123456

然后,重启,访问http://localhost:8080/health 得到

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
{
    "status": "UP",
    "diskSpace": {
        "status": "UP",
        "total": 126702579712,
        "free": 71547412480,
        "threshold": 10485760
    }
}

端点endpoint

Actuator endpoints可以让我们监控和与我们的应用(application)交互。Spring Boot actuator包含了大量的内置endpoints, 当然,我们也可以添加我们自己的。

如何暴露端口取决与你采用的技术。大多数应用采用HTTP监控,这时,endpoint的ID就映射为一个接口URL。比如,默认health映射为/health. (2.0貌似不是这样,后面再看)

自带的内置endpoint大概有这些(sensitive是指需要密码):

ID

Description

Sensitive Default

actuator

提供端点基本信息,"discovery page"

true

auditevents

提供审计事件信息

true

autoconfig

提供auto-configuration报告,显示所有的自动配置项以及生效和不生效的原因

true

beans

显示应用中所有的bean

true

configprops

显示整理过的@ConfigurationProperties

true

dump

显示线程dump信息

true

env

显示Spring的ConfigurableEnvironment属性

true

flyway

显示应用的所有Flyway database迁移

true

health

显示系统健康状态(登陆后显示详细信息)

false

info

显示一些自定义信息

false

loggers

显示和更改应用的logger配置

true

liquibase

显示所有的Liquibase database迁移

true

metrics

显示当前的metrics信息

true

mappings

显示所有@RequestMapping

true

shutdown

允许应用程序正常关机(默认情况下未启用)。

true

trace

显示跟踪信息(默认情况下是最近的100个HTTP请求)

true

如果是Spring MVC, 还有以下几个:

ID

Description

Sensitive Default

docs

显示actuator的文档。需要引入spring-boot-actuator-docs

false

heapdump

返回hprof 文件

true

jolokia

通过HTTP公开JMX bean(当Jolokia位于类路径中时)。

true

logfile

返回日志文件的内容(如果logging.file或logging.path属性已设置)。支持使用HTTP范围头来检索部分日志文件的内容。

true

根据endpoint的作用,可以将原生endpoint分为3类

  1. 应用配置类: 获取应用程序中加载的应用配置、环境变量、自动化配置报告等与Spring Boot应用密切相关的配置类信息。
  2. 度量指标类: 获取应用程序运行过程中用于监控的度量指标,比如内存信息、线程池信息、HTTP请求统计等。
  3. 操作控制类:提供对应用的关闭等操作类功能。

应用配置类

由于Spring Boot为了改善传统Spring应用复杂的配置,采用了包扫描和自动化配置机制来加载原来集中与XML的内容。虽然这样做让我们代码变得简洁,但整个应用的实例创建和依赖关系等信息都被离散到了各个配置类的注解上。这使我们分析整个应用中资源和实例的各种关系变得非常困难。而这类endpoint可以帮助我们轻松获取一系列关于Spring配置内容的详细报告,比如自动化配置的报告、Bean创建的报告、环境属性的报告等。

/env: 对于密码属性,属性名中包含password、secret、key这些关键词,会返回**代替value。

/info: 自定义

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
info.app.name=spring boot demo
info.app.version=1.0

度量指标类

/metrics: 返回内存信息、线程信息、垃圾回收信息等。

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
{
    "mem": 437985,
    "mem.free": 342068,
    "processors": 4,
    "instance.uptime": 19821025,
    "uptime": 19812936,
    "systemload.average": -1,
    "heap.committed": 382464,
    "heap.init": 131072,
    "heap.used": 40395,
    "heap": 1846272,
    "nonheap.committed": 56848,
    "nonheap.init": 2496,
    "nonheap.used": 55521,
    "nonheap": 0,
    "threads.peak": 25,
    "threads.daemon": 21,
    "threads.totalStarted": 28,
    "threads": 23,
    "classes": 6792,
    "classes.loaded": 6843,
    "classes.unloaded": 51,
    "gc.ps_scavenge.count": 8,
    "gc.ps_scavenge.time": 98,
    "gc.ps_marksweep.count": 3,
    "gc.ps_marksweep.time": 322,
    "httpsessions.max": -1,
    "httpsessions.active": 0,
    "gauge.response.actuator": 224,
    "gauge.response.loggers": 23,
    "gauge.response.env": 12,
    "gauge.response.docs.star-star": 19,
    "gauge.response.autoconfig": 67,
    "gauge.response.trace": 17,
    "gauge.response.metrics": 8,
    "gauge.response.heapdump.root": 2656,
    "gauge.response.docs": 3,
    "gauge.response.configprops": 167,
    "gauge.response.star-star": 8,
    "counter.status.302.docs": 2,
    "counter.status.200.actuator": 1,
    "counter.status.200.loggers": 1,
    "counter.status.200.docs.star-star": 4,
    "counter.status.200.metrics": 2,
    "counter.status.200.configprops": 1,
    "counter.status.404.star-star": 5,
    "counter.status.200.autoconfig": 1,
    "counter.status.200.heapdump.root": 1,
    "counter.status.200.env": 1,
    "counter.status.200.trace": 1
}
  1. 系统信息:包括处理器数量processors,运行时间uptime和instance.uptime,系统平均负载systemload.average.
  2. mem.*: 内存概要信息。包括分配给应用的总内存数量以及当前空闲的内存数量。这些信息来自java.lang.Runtime。
  3. heap.*: 堆内存使用情况。 这些信息来自 java.lang.management.MemoryMXBean 接口中 getHeapMemoryUsage 方法获取的 java.lang.management.MemoryUsage。
  4. nonheap. *: 非堆内存使用情况。 这些信息来自 java.lang.management.MemoryMXBean接口中ge七NonHeapMemoryUsage方法获取的java.lang.managemen七.MemoryUsage。
  5. threads.*: 线程使用情况,包括线程数、守护线程数(daemon汃线程峰值(peak)等,这些数据均来自java.lang.management.ThreadMXBean。
  6. classes.*: 应用加载和卸载的类统计。这些数据均来自java.lang.management.ClassLoadingMXBean。
  7. gc. *: 垃圾收集器的详细信息,包括垃圾回收次数gc.ps—scavenge.count、垃圾回收消耗时间 gc.ps _ scavenge.time、 标记-清除算法的次数 gc.psmarksweep.count、 标记-清除算法的消耗时间gc.ps_marksweep.time。这些数据均来自java.lang.managemen七.GarbageCollectorMXBean。
  8. httpsessions. * : Tomcat容 器 的会话使用情况。包括最大会话数httpsessions.max和活跃会话数httpsessions.ac巨ve。 该度量指标信息仅在引入嵌入式Tomcat作为应用容器的时候才会提供。
  9. gauge.*: HTTP请求的性能指标之 一 ,它主要用来反映 一 个绝对数值。 比如上面示例中的gauge.response.hello: 5, 它表示上一次hello请求的延迟时间为5毫秒。
  10. counter.*: HTTP 请求的性能指标之 一 ,它主要作为计 数器来使用,记录了增加量和减少量。 上述示例中的counter.s七红us.200.hello: 11, 它代表了 hello请求返回200状态的次数为11。

对于gauge.和counter.的统计, 这里有一 个特殊的内容请求 star-star,它代表了对静态资源的访问。 这两类度量指标非常有用,我们不仅可以使用它默认的统计指标,还可以在程序中轻松地增加自定义 统计 值。只需要通过注org.springframework.boot.actuate.metrics.CounterService和org.springframework.boot.actuate.metrics.GaugeService 来实现自定义的统计指标信息。比如我们可以像下面这样自定义实现对hello接口的访问次数统计。

代码语言:javascript
代码运行次数:0
运行
AI代码解释
复制
@RestController
public class HelloController {

    @Qualifier("counterService")
    @Autowired
    private CounterService counterService;

    @RequestMapping(value = "hello", method = RequestMethod.GET)
    public String hello(){
        counterService.increment("test.hello.count");

        return counterService.toString();
    }


}

/metrics端点可以提供应用运行状态的完整度量指标报告,这项功能 非常实用,但是对千监控系 统中的各项监控功能,它们的监控内容、 数据收集频率都有所不同,如果每次都通过全量获取报告的方式来收集,略显粗暴。 所以,我们还可以通过/metrics/{name}接口来更细粒度地获取度量信息 , 比如可以通过访问/metrics/mem.free来获取当前可用内存数量。

/health: 在spring-boot-s七arter-ac七uator模块中自带实现了一 些常用资源的健康指标检测器。这些检测器 都通过Hea巨hindicator接口实现,并且会根据依赖关系的引入实现自动化装配, 比如下面列出的这些。

CassandraHealthIndicator,DiskSpaceHealthIndicator,DataSourceHealthIndicator,ElasticsearchHealthIndicator,JmsHealthIndicator,MailHealthIndicator,MongoHealthIndicator,RabbitHealthIndicator,RedisHealthIndicator,SolrHealthIndicator

可以通过management.health.defaults.enabled来控制上述健康检查是否生效。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
暂无评论
推荐阅读
编辑精选文章
换一批
springboot Actuator
springboot Actuator只需要加入依赖即可使用: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> application.properties 中可以加入以下配置: # false,表示不敏感,可以随意访问,否则就是做了一些保护,不能随意访问。 endpoints.mapping
yawn
2018/03/14
6960
第11章 Spring Boot应用监控第11章 Spring Boot应用监控小结
在实际的生产系统中,我们怎样知道我们的应用运行良好呢?我们往往需要对系统实际运行的情况(各种cpu,io,disk,db,业务功能等指标)进行监控运维。这需要耗费我们不少精力来搞这些工作。在SpringBoot中,我们完全不需要面对这样的难题。
一个会写诗的程序员
2018/08/20
1.4K0
springBoot系列教程01:elasticsearch的集成及使用
 1.首先安装elasticsearch 集群环境,参考 http://www.cnblogs.com/xiaochangwei/p/8033773.html
肖哥哥
2018/08/02
1.1K0
springBoot系列教程01:elasticsearch的集成及使用
Spring Boot :四大神器之Actuator
Spring Boot有四大神器,分别是auto-configuration、starters、cli、actuator,本文主要讲actuator。actuator是spring boot提供的对应用系统的自省和监控的集成功能,可以对应用系统进行配置查看、相关功能统计等。
Freedom123
2024/03/29
1750
Spring Boot :四大神器之Actuator
SOFARPC源码解析-搭建环境
简介摘要 SOFA 是蚂蚁金服自主研发的金融级分布式中间件,包含构建金融级云原生架构所需的各个组件,包括微服务研发框架,RPC 框架,服务注册中心,分布式定时任务,限流/熔断框架,动态配置推送,分布式链路追踪,Metrics监控度量,分布式高可用消息队列,分布式事务框架,分布式数据库代理层等组件,是一套分布式架构的完整的解决方案,也是在金融场景里锤炼出来的最佳实践。 SOFARPC是蚂蚁金服开源的高可扩展性、高性能、生产级的Java RPC框架。SOFARPC致力于简化应用之间的RPC调用,为应用提供方便透明、稳定高效的点对点远程服务调用方案。为了用户和开发者方便的进行功能扩展,SOFARPC提供丰富的模型抽象和可扩展接口,包括过滤器、路由、负载均衡等等。 SOFARPC功能特性:(1)透明化、高性能的远程服务调用;(2)支持多种服务路由及负载均衡策略;(3)支持多种注册中心的集成;(4)支持多种协议;(5)支持同步、单向、回调、泛化等多种调用方式;(6)支持集群容错、服务预热、自动故障隔离;(7)强大的扩展功能,可以按需扩展各个功能组件。 SOFARPC Github:https://github.com/alipay/sofa-rpc 架构设计 SOFARPC从下到上分为两层:核心层:包含RPC 的核心组件(例如我们的各种接口、API、公共包)以及一些通用的实现(例如随机等负载均衡算法)。功能实现层:所有的功能实现层的用户都是平等的,都是基于扩展机制实现的。
爱撸猫的杰
2019/03/28
1.3K0
SOFARPC源码解析-搭建环境
Spring Boot的应用启动与关闭
Spring Boot应用可以打成jar包,其中内嵌tomcat,因此可以直接启动使用。但是在Spring Boot应用启动之前,首先需要进行打包,本文讲述的是Maven工程的打包,打包需要的前提条件(pom.xml文件中的内容)是:
Tyan
2019/05/25
1.7K0
Spring Boot Admin 2 值得了解的新变化
6.19号,spring团队发布了期待已久的 Spring Cloud Finchley.RELEASE 版本。 期间Spring Boot Admin 也发布了 2.0.1 兼容它,我在升级pig 到Finchley.RELEASE的同时 发现很多有意思的变化整理发出来
冷冷
2018/06/28
1.2K0
01-如何在 Spring Boot 应用程序中使用 Actuator 监控和管理端点,提高应用程序的生产力?
健康信息可以检查应用的运行状态,它经常被监控软件用来提醒人们生产环境是否存在问题。health端点暴露的默认信息取决于端点是如何被访问的。
JavaEdge
2023/05/24
9890
01-如何在 Spring Boot 应用程序中使用 Actuator 监控和管理端点,提高应用程序的生产力?
SpringBoot入门建站全系列(二十九)Actuator服务监控及SpringBootMonitor单机监控页面
Actuaotr是spring boot项目中非常强大的一个功能,有助于对应用程序进行监控和管理,通过restful api请求来监管、审计、收集应用的运行情况,针对微服务而言它是必不可少的一个环节。
品茗IT
2020/05/28
2.4K0
《Kotin 极简教程》第11章 使用Kotlin 集成 SpringBoot开发Web服务端第11章 使用Kotlin集成SpringBoot开发Web服务端《Kotlin极简教程》正式上架:
我们在前面第2章 “ 2.3 Web RESTFul HelloWorld ” 一节中,已经介绍了使用 Kotlin 结合 SpringBoot 开发一个RESTFul版本的 Hello World。当然,Kotlin与Spring家族的关系不止如此。在 Spring 5.0 M4 中引入了一个专门针对Kotlin的支持。
一个会写诗的程序员
2018/08/17
3.2K0
《Kotin 极简教程》第11章 使用Kotlin 集成 SpringBoot开发Web服务端第11章 使用Kotlin集成SpringBoot开发Web服务端《Kotlin极简教程》正式上架:
SpringBoot监控工具之《Actuator》
有句话怎么说呢?学的越多,不知道的就越多,现在感觉学的越来越废了,不学又不行,最近一直在钻研 SpringBoot相关的内容,准备先写一些基础的案例代码,后续研究的更加透彻,写一些有内涵的刨析文章发表出来,下面开始吧!
框架师
2021/11/22
1.7K0
SpringBoot监控工具之《Actuator》
Spring Boot Actuator监控使用详解
版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
程序新视界
2019/11/20
1.9K0
SpringBoot2.0 基础案例(16):配置Actuator组件,实现系统监控
在生产环境中,需要实时或定期监控服务的可用性。Spring Boot的actuator(健康监控)功能提供了很多监控所需的接口,可以对应用系统进行配置查看、相关功能统计等。
知了一笑
2019/07/19
5350
SpringCloud 2.x学习笔记:22、使用Sentinel实现接口限流
https://github.com/alibaba/Sentinel/releases
程裕强
2019/07/11
1.8K0
SpringCloud 2.x学习笔记:22、使用Sentinel实现接口限流
原 荐 SpringBoot 2.0 系列0
SpringBoot 2.0 系列004 --启动实战之配置文件 配置文件 配置文件加载流程 很多文档包括官方文档说SB的默认配置文件是application开头的文件,那么是为什么呢? 我们先
石奈子
2018/06/13
8900
Spring Boot 2.0 新特性(二):新增事件ApplicationStartedEvent
今天继续来聊Spring Boot 2.0的新特性。本文将具体说说2.0版本中的事件模型,尤其是新增的事件: ApplicationStartedEvent。 原文首发:http://blog.didispace.com/Spring-Boot-2-0-feature-2-ApplicationStartedEvent/ 在Spring Boot 2.0中对事件模型做了一些增强,主要就是增加了 ApplicationStartedEvent事件,所以在2.0版本中所有的事件按执行的先后顺序如下: Appli
程序猿DD
2018/03/21
2K0
聊聊springcloud的serviceRegistryEndpoint
本文主要研究一下springcloud的serviceRegistryEndpoint
code4it
2018/09/17
1.4K0
第一节,创建第一个springboot项目
版权声明:本文为博主原创文章,未经博主允许不得转载。 本系列使用工具 IDEA 1.创建项目 2.新创建完项目目录 3.开启项目 有键打开 执行 如下图,就代表启动成功了 . __
DencyCheng
2018/11/05
7650
Spring Boot Actuator详解与深入应用(二):Actuator 2.x
本文系《Spring Boot Actuator详解与深入应用》中的第二篇。在上一篇文章:Spring Boot Actuator详解与深入应用(一):Actuator 1.x主要讲了Spring Boot Actuator 1.x的应用与定制端点。Spring Boot2.0的正式版已经发布有一段时间了,目前已经到了2.1.0.RELEASE。关于Spring Boot2.x的特性,在此不详细叙述了,但是其流行的趋势是显而易见的。
aoho求索
2018/12/17
2.5K0
微服务架构之Spring Boot(七十三)
端点上的操作通过其参数接收输入。通过Web公开时,这些参数的值取自URL的查询参数和JSON请求体。通过JMX公开时,参数将映射到
用户1289394
2022/05/23
2.3K0
推荐阅读
相关推荐
springboot Actuator
更多 >
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
本文部分代码块支持一键运行,欢迎体验
本文部分代码块支持一键运行,欢迎体验