Appearance
业务联机监控
1.前提
业务系统集成 comet-ig-stat 模块。当前版本默认已经集成,监控功能默认是 关闭 状态。
2.使用说明
在 comet-ig-stat 分别对联机交易从 IO 和业务流程层面做了监控;在 IO 监控中,分别对不同的监控有多种实现,具体的使用方式下面章节详细说明。
默认情况下,只需要添加以下的配置,即可开启 IO 和 Business 监控,并且会统计每笔交易耗时。
yaml
comet:
stat:
enabled: true
如果要对耗时大于指定毫秒的交易做统计,可以添加配置 comet.stat.minPrintElapsedTimeMills=0。
2.1 业务联机监控配置
如果要对 IO 和 Business 的监控开关分别配置,可参考以下配置:
yaml
comet:
stat:
enabled: true
io:
enabled: true
business:
enabled: true
如果要针对 IO 和 Business 中具体的某一个 IO 操作或者业务执行流程的监控开关分别配置,可以参考以下配置:
yaml
comet:
stat:
enabled: true
io:
enabled: true
cache:
enabled: true
http:
enabled: true
sql:
enabled: true
transaction:
enabled: true
uid:
enabled: true
business:
enabled: true
extraBusiness:
enabled: true
flowExceptionHandler:
enabled: true
flowHandler:
enabled: true
flowProcessHandler:
enabled: true
postHandler:
enabled: true
preHandler:
enabled: true
2.2 IO 监控
IO 监控分别统计了缓存耗时监控、rpc 调用耗时监控、SQL 执行耗时监控、事务耗时监控、获取序列耗时监控。其中 rpc 调用监控和事务耗时统计不需要做其他配置。
2.2.1 缓存监控
缓存监控分别可以监控到 Orbit 缓存和 JetCache 缓存,开启方法如下。
- Orbit 缓存开启方法:
- 去掉启动类的 @EnableCache 注解
- 在 application.yml 添加配置
yaml
orbit:
enabled: true
- JetCache 缓存开启方法:
- 在启动类上加 @EnableCache(basePackages = {"com.dcits.ensemble"})
- 在 application.yml 添加配置
yaml
orbit:
enabled: false
2.2.2 SQL 监控
SQL 监控分别可以监控 Druid 数据源、Libra 数据源以及使用 Mybatis 拦截器监控其他数据源。
使用 Druid 监控时,需要开启 stat 监控:
yaml
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
druid:
filters: stat,wall,log4j
filter:
stat:
enabled: true
Libra 监控
yaml
spring:
datasource:
type: com.dcits.libra.client.core.jdbc.api.LibraDataSource
Mybatis 监控
开启 Mybatis 监控需要在 resource/mybatis/mybatis-config.xml 添加以下配置。
xml
<plugin interceptor="com.dcits.comet.stat.stat.io.sql.mybatis.MybatisSqlStatInterceptor">
2.2.3 序列监控
在核心系统中目前支持 Mars 和 Redis 序列
开启 Mars 序列的配置:
yaml
sequences:
enabled: true
开启 Redis 序列时,需要先关闭 Mars 序列
yaml
sequences:
enabled: false
comet:
sequence:
enable: true