当前位置: 首页 > news >正文

设计类专业网站建设银行网站注销

设计类专业网站,建设银行网站注销,谷歌网站建设代理,开发流程图参考: https://www.yuque.com/leifengyang/springboot3/wsx0br0dalot1pqn 作用: 对线上应用进行观测、监控、预警… 比如: ● 健康状况【组件状态、存活状态】Health ● 运行指标【cpu、内存、垃圾回收、吞吐量、响应成功率…】Metrics ● 链路追踪 1.使用 1.场景引入 …参考: https://www.yuque.com/leifengyang/springboot3/wsx0br0dalot1pqn 作用: 对线上应用进行观测、监控、预警… 比如: ● 健康状况【组件状态、存活状态】Health ● 运行指标【cpu、内存、垃圾回收、吞吐量、响应成功率…】Metrics ● 链路追踪 1.使用 1.场景引入 dependencygroupIdorg.springframework.boot/groupIdartifactIdspring-boot-starter-actuator/artifactId /dependency2.暴露指标 在application.properties里面进行设置 #暴露所有端点信息 management.endpoints.web.exposure.include* #以web方式暴露 management.endpoint.health.enabledtrue3.访问数据 ● 访问 http://localhost:8080/actuator展示出所有可以用的监控端点 ● http://localhost:8080/actuator/beans ● http://localhost:8080/actuator/configprops ● http://localhost:8080/actuator/metrics ● http://localhost:8080/actuator/metrics/jvm.gc.pause ● http://localhost:8080/actuator/endpointName/detailPath 2.Endpoint 常用端点: 默认提供了各种端点来展示应用的详细信息 包括看有多少线程及线程运行情况生成堆dump等各种端点 参考: https://www.yuque.com/leifengyang/springboot3/wsx0br0dalot1pqn?inneru8Ebe 3.如何自定义端点 自定义HealthEndpoint和MetricsEndpoint 3.1 HealthEndpoint 1.自定义健康端点 例如监控一个组件的状态存活还是死亡 方法: 实现HealthIndicator接口或者继承AbstractHealthIndicator来实现 1)实现HealthIndicator接口–类名必须以HealthIndicator结尾并且实现HealthIndicator接口spring boot就能够确定这个组件是用来监控的 一句话总结下面的代码: 实现HealthIndicator接口的health方法返回Health对象 import org.springframework.boot.actuate.health.Health; import org.springframework.boot.actuate.health.HealthIndicator; import org.springframework.stereotype.Component;Component public class MyHealthIndicator implements HealthIndicator {Overridepublic Health health() {int errorCode check(); // perform some specific health checkif (errorCode ! 0) {return Health.down().withDetail(Error Code, errorCode).build();}return Health.up().build();}}//构建Health Health build Health.down().withDetail(msg, error service).withDetail(code, 500).withException(new RuntimeException()).build();需要下面的配置来开启健康管理以及展示详细信息: application.properties里面进行配置: management.endpoint.health.show-detailsalways2)继承AbstractHealthIndicator来实现 例子: 自定义一个健康监控的端点来监控某个组件的健康状态 一句话总结下面的代码: 继承AbstractHealthIndicator实现里面的doHealthCheck方法通过builder创建好Health对象 /*** author lfy* Description* create 2023-05-08 22:59** 1、实现 HealthIndicator 接口来定制组件的健康状态对象Health 返回* 2、*/ Component public class MyHahaHealthIndicator extends AbstractHealthIndicator {AutowiredMyHahaComponent myHahaComponent; // 要检查的组件会从容器中找自动注入进来/*** 健康检查* param builder* throws Exception*/Overrideprotected void doHealthCheck(Health.Builder builder) throws Exception {//调用组件自定义的检查方法来检查应用的状态int check myHahaComponent.check();if(check 1){//存活builder.up().withDetail(code,1000).withDetail(msg,活的很健康).withDetail(data,我的名字叫haha).build();}else {//下线builder.down().withDetail(code,1001).withDetail(msg,死的很健康).withDetail(data,我的名字叫haha完蛋).build();}} }同样需要下面的配置来开启健康管理以及展示详细信息: application.properties里面进行配置: management.endpoint.health.show-detailsalways3.2 MetricsEndpoint 例子:自定义一个metric来监控某个方法被调用了多少次 总结:自定义metric是通过注入的MeterRegistry实现实现一个有参构造方法参数是MeterRegistry然后通过MeterRegistry里面提供的方法来实现比如计数器counter Component public class MyHahaComponent {Counter counter null;/*** 注入 meterRegistry 来保存和统计所有指标* param meterRegistry*/public MyHahaComponent(MeterRegistry meterRegistry){ // 只有一个有参构造方法参数自动从容器中找然后注入meterRegistry//得到一个名叫 myhaha.hello 的计数器//这个myhaha.hello会被展示在metrics中通过这个指标就能得到hello方法被访问了多少次counter meterRegistry.counter(myhaha.hello);}public int check(){//业务代码判断这个组件是否该是存活状态return 1;}// hello被调用一次就记一次数public void hello(){System.out.println(hello);// 调用一次就记一次数counter.increment();} }4.还可以整合Prometheus Grafana来展示这些端点提供的数据 大概得步骤是: 引入Prometheus 和 Grafana的场景分别做一些配置设置Prometheus数据源配置Grafana监控面板 https://www.yuque.com/leifengyang/springboot3/wsx0br0dalot1pqn
http://www.zqtcl.cn/news/493612/

相关文章:

  • 本地做织梦网站做软件怎么赚钱
  • a站全称重庆大学网络教育平台
  • 美橙做过网站案例好文案网站
  • 鞍山商城网站建设国外代理ip
  • 东莞网站设计风格wordpress不能启动怎么解决
  • 社交网站制作临海建设局网站导航
  • 合肥需要做网站的公司佛山网站制作的公司
  • 哪里有做网站平台建设网站如何盈利
  • dw网站制作素材单人做网站需要掌握哪些知识
  • 网络推广产品公司做移动网站优化首
  • 网站建设dqcx广告网络用语
  • 烟台网站建设首推企汇互联见效付款手机网站宽度自适应
  • 网站建设小程序湖南wordpress插件刷不出来
  • 中国建设银行网站首页joy荣添创意网站建设
  • 市场营销网站网站开发技术项目说明书
  • 销售网站开发的背景wordpress虚线框可序列
  • 免费响应式网站深圳关键词优化
  • 网站宣传模式做微视频的网站
  • 网站改版后的内容福建 网站建设
  • 网站的文件夹企业邮箱在哪查看
  • 开了360网站卫士ssl如何做301深圳制作网站开发费用
  • 在哪里做马可波罗网站公众号自己做电影网站
  • 网站建设音乐插件怎么弄陕西城乡建设部网站首页
  • 全国免费自学网站打开百度网站首页
  • 国外网站开发公司晋江论坛网
  • 问卷调查网站个人网站源码免费下载
  • 网站备案信息核验单填写建设企业网站价钱
  • 相城建设监理有限公司网站网页设计中html代码
  • 做农产品网站高端汽车
  • 工信部网站首页wordpress网站搬家vps