Arthas
Arthas 是一款Java应用诊断利器,官方地址为:https://arthas.gitee.io/
启动:
# 指定端口启动
./as.sh --telnet-port 9998监测方法的耗时:
# 监测单个方法执行时间
trace com.rhdk.contractservice.contract.service.AbstractContractService doHibernateValidate -n 10
# 监测多个方法执行时间
trace -n 10 -E com.rhdk.contractservice.contract.service.AbstractContractService|com.rhdk.contractservice.contract.service.impl.PurchaseBusinessService update
trace -n 10 -E com.rhdk.contractservice.contract.service.AbstractContractService|com.rhdk.contractservice.contract.service.impl.PurchaseBusinessService|com.rhdk.contractservice.feign.RemoteUserFeignResolver doUpdateContract|getOrgName
# 监测不跳过jdk的方法
trace --skipJDKMethod false demo.MathGame run
# 监测大于10ms的方法
trace demo.MathGame run '#cost > 10'
# 监测排除指定的类
trace javax.servlet.Filter * --exclude-class-pattern com.demo.TestFilterjprofiler 火焰图生成:
配置nginx访问火焰图:
使用watch命令监控方法出入参:
监控有参数的methodName方法的入参、返回值、异常信息:
watch com.spicrhdk.jupiter.auth.biz.service.impl.serviceutil.AppOrgTypeService checkOrgTypeIsInner '{params,returnObj,throwExp}' -n 5 -x 3 'params.length >0 && params[0] instanceof java.lang.Integer && params[1] instanceof java.lang.String'
最后更新于
这有帮助吗?