博客
关于我
Spring boot admin监控包括链路追踪失效解决方案!!!
阅读量:692 次
发布时间:2019-03-17

本文共 2102 字,大约阅读时间需要 7 分钟。

Spring Boot Admin监控系统配置与实践

通过对多个监控系统的调研,我发现Spring Boot Admin能够通过简单的配置实现对Spring Boot应用的全面监控。这篇文章将从配置与实践入手,详细介绍Spring Boot Admin的使用方法。


POM.xml配置

在使用Spring Boot Admin之前,首先需要在项目的依赖管理中添加相关jar包。以下是POM.xml的配置示例:

de.codecentric
spring-boot-admin-starter-server
2.2.2
de.codecentric
spring-boot-admin-starter-client
2.2.2

注意事项: 确保使用与Spring Boot Admin兼容的Spring Boot版本(建议从2.2.0.M3版本开始)。


application.yml配置

application.yml中,需要配置Spring Boot Admin的服务端和客户端信息。以下是常见配置示例:

spring:  boot:    admin:      context-path: /bootAdmin      client:        instance:          prefer-ip: true        url: http://localhost:${server.port}/${spring.boot.admin.context-path}/        enabled: true      ui:        poll-timer:          process: 2500          threads: 2500          memory: 2500    endpoints:      web:        exposure:          include: "*"      health:        redis:          enabled: false

详细信息展示

Spring Boot Admin支持展示服务的详细信息,主要包括以下几个方面:

  • info:基本信息,支持配置git仓库信息、项目描述等内容。
  • health:服务健康信息,包括依赖组件状态、磁盘健康等。
  • metadata:存储自定义数据,适用于需要共享配置的场景。
  • process:本地进程信息,显示PID、CPU使用率等。
  • threads:线程信息,包括活跃线程和守护线程数量。
  • GC Pauses:Java垃圾回收机制的性能数据。
  • Memory:内存使用情况,包括堆内存和非堆内存。

  • 日志查看功能

    Spring Boot Admin支持日志查看功能,需要在application.yml中配置日志文件路径。以下是常见配置示例:

    logging:  file:    path: /var/log/app.log    max-history: 30    log-file-name-pattern: ${spring.application.name}-%d.log

    JVM监控

    Spring Boot Admin提供了对JVM性能的监控,包括以下内容:

  • Thread:查看和管理Java线程,支持查看每个线程的详细信息。
  • Heap Dump:生成Java堆内存快照文件,便于分析内存问题。

  • Web配置

    Spring Boot Admin支持对Web应用的监控,包括以下功能:

  • Mappings:查看所有Web映射,包括Actuator端点和Servlet映射。
  • Http Traces:支持链路追踪功能,帮助开发人员分析请求路径。

  • 链路追踪失效解决方案

    在Spring Boot 2.2.2版本中,HttpTraceRepository被改为条件式声明,默认禁用了链路追踪功能。以下是解决方案:

  • application.yml中添加以下配置:
  • spring:  boot:    admin:      endpoints:        health:          show-details: always    web:      resources:        - path: /actuator/          label: Actuator endpoints
    1. 如果需要链路监测功能,可以通过启用InMemoryHttpTraceRepository实现。

    2. 通过以上配置和实践,Spring Boot Admin能够帮助开发人员快速实现对Spring Boot应用的监控和管理。如果需要更深入的配置和使用场景,可以参考Spring Boot Admin的官方文档或相关技术博客。

    转载地址:http://zrbhz.baihongyu.com/

    你可能感兴趣的文章
    mysql8 配置文件配置group 问题 sql语句group不能使用报错解决 mysql8.X版本的my.cnf配置文件 my.cnf文件 能够使用的my.cnf配置文件
    查看>>
    MySQL8.0.29启动报错Different lower_case_table_names settings for server (‘0‘) and data dictionary (‘1‘)
    查看>>
    MYSQL8.0以上忘记root密码
    查看>>
    Mysql8.0以上重置初始密码的方法
    查看>>
    mysql8.0新特性-自增变量的持久化
    查看>>
    Mysql8.0注意url变更写法
    查看>>
    Mysql8.0的特性
    查看>>
    MySQL8修改密码报错ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
    查看>>
    MySQL8修改密码的方法
    查看>>
    Mysql8在Centos上安装后忘记root密码如何重新设置
    查看>>
    Mysql8在Windows上离线安装时忘记root密码
    查看>>
    MySQL8找不到my.ini配置文件以及报sql_mode=only_full_group_by解决方案
    查看>>
    mysql8的安装与卸载
    查看>>
    MySQL8,体验不一样的安装方式!
    查看>>
    MySQL: Host '127.0.0.1' is not allowed to connect to this MySQL server
    查看>>
    Mysql: 对换(替换)两条记录的同一个字段值
    查看>>
    mysql:Can‘t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock‘解决方法
    查看>>
    MYSQL:基础——3N范式的表结构设计
    查看>>
    MYSQL:基础——触发器
    查看>>
    Mysql:连接报错“closing inbound before receiving peer‘s close_notify”
    查看>>