美文网首页
SpringBoot Actuator

SpringBoot Actuator

作者: quanCN | 来源:发表于2020-12-31 17:52 被阅读0次

    简介

    Actuator是Springboot提供的用来对应用系统进行自省和监控的功能模块,借助于Actuator开发者可以很方便地对应用系统某些监控指标进行查看、统计等。
    文档

    基本使用

    • 导入

      <dependency>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-actuator</artifactId>
      </dependency>
      
    • 端点
      Actuator插件提供了一系列HTTP请求,我们可以发送相应的请求,来获取SpringBoot应用的相关信息。这些HTTP请求都是GET类型的,而且都不带任何请求参数,它们就是所谓的“端点”(Endpoint)。Actuator提供了一下端点

      端点 描述
      beans 获取Spring Bean基本信息
      health 获取健康检查
      info 获取应用基本信息
      env 获取环境变量信息
      configprops 获取配置信息
      mappings 获取请求映射信息
      metrics 获取性能指标信息
    • 基本使用

      #开启全部端点
      management.endpoints.web.exposure.include=*
      #关闭默认
      management.endpoints.enabled-by-default=false
      #开启指定端点方法1
      management.endpoint.health.enabled=true
      management.endpoint.env.enabled=true
      #开启指定端点方法2
      management.endpoints.web.exposure.include= beans,metrics,info,health,loggers
      

    相关文章

      网友评论

          本文标题:SpringBoot Actuator

          本文链接:https://www.haomeiwen.com/subject/bvdroktx.html