前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >arthas教程3

arthas教程3

作者头像
IT云清
发布2019-10-25 09:32:40
4300
发布2019-10-25 09:32:40
举报
文章被收录于专栏:IT云清IT云清

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

本文链接:https://blog.csdn.net/weixin_39800144/article/details/100526503

本文介绍:watch的使用

7.watch命令

watch命令,在排查复线线上问题时非常有效。

1. 监控com.runlion.fsp.credit.service.impl.CreditServiceImpl 类的listCreditAndUserOnCondition方法返回值,及方法耗时:
代码语言:javascript
复制
$ watch com.runlion.fsp.credit.service.impl.CreditServiceImpl listCreditAndUserOnCondition returnObj 

然后就会阻塞状态,线上排查问题时,这时就可以去重新触发此方法,查看返回值信息

代码语言:javascript
复制
$ watch com.runlion.fsp.credit.service.impl.CreditServiceImpl listCreditAndUserOnCondition returnObj 
Press Q or Ctrl+C to abort.
Affect(class-cnt:2 , method-cnt:2) cost in 203 ms.
ts=2019-09-03 19:14:48; [cost=364.531509ms] result=@FspPageInfo[
    pageNum=@Integer[1],
    pageSize=@Integer[20],
    total=@Long[234],
    pages=@Integer[12],
    result=@Page[isEmpty=false;size=20],
]
ts=2019-09-03 19:14:48; [cost=403.969714ms] result=@FspPageInfo[
    pageNum=@Integer[1],
    pageSize=@Integer[20],
    total=@Long[234],
    pages=@Integer[12],
    result=@Page[isEmpty=false;size=20],
]

显然,整个结果我们并不满意,我们想看人能读懂的数据。

watch有多个参数:

在这里插入图片描述
在这里插入图片描述
2. 我们注意最后一个,指定属性遍历深度,刚才的遍历深度没有指定,默认为1,所以没有具体到数据,我们设置为3看一下:
代码语言:javascript
复制
$ watch com.runlion.fsp.credit.service.impl.CreditServiceImpl listCreditAndUserOnCondition returnObj -x 3
代码语言:javascript
复制
$ watch com.runlion.fsp.credit.service.impl.CreditServiceImpl listCreditAndUserOnCondition returnObj -x 3
Press Q or Ctrl+C to abort.
Affect(class-cnt:2 , method-cnt:2) cost in 205 ms.
ts=2019-09-03 19:21:37; [cost=419.18139ms] result=@FspPageInfo[
    pageNum=@Integer[1],
    pageSize=@Integer[20],
    total=@Long[234],
    pages=@Integer[12],
    result=@Page[
        @CreditDetailVo[
            creditId=@String[CRED19090300001871],
            userName=@String[15995055310],
            realName=@String[溧阳市神马机电设备安装有限公司],
            phone=@String[15995055310],
            userProp=@Integer[1],
            userPropStr=@String[供应商],
            userType=@Integer[1],
            userTypeStr=@String[企业],
            productId=@String[LPRO19080800000001],
            productName=@String[自助贷],
            relatedCompanyName=@String[漳平红狮水泥有限公司],
            moneyResourceOrganizationName=null,
            creditTotal=@BigDecimal[46800.00],
            creditUsed=@BigDecimal[0.00],
            creditResidue=@BigDecimal[42545.45],
            deleted=@Integer[0],
            deletedStr=@String[正常],
            gmtCreate=@Date[2019-09-03 16:56:41,000],
            channelUserName=@String[20500030],
        ],
        @CreditDetailVo[
            creditId=@String[CRED19090300001872],
            userName=@String[15995055310],
            realName=@String[溧阳市神马机电设备安装有限公司],
            phone=@String[15995055310],
            userProp=@Integer[1],
            userPropStr=@String[供应商],
            userType=@Integer[1],
            userTypeStr=@String[企业],
            productId=@String[LPRO19080800000002],
            productName=@String[应收账款质押贷],
            relatedCompanyName=@String[漳平红狮水泥有限公司],
            moneyResourceOrganizationName=null,
            creditTotal=@BigDecimal[46800.00],
            creditUsed=@BigDecimal[0.00],
            creditResidue=@BigDecimal[42545.45],
            deleted=@Integer[0],
            deletedStr=@String[正常],
            gmtCreate=@Date[2019-09-03 16:56:41,000],
            channelUserName=@String[20500030],
        ],
3. 我们同时监控入参和出参:

页面请求时设置startTimeF和endTimeF两个参数,然后监控结果:

代码语言:javascript
复制
$ watch com.runlion.fsp.credit.service.impl.CreditServiceImpl listCreditAndUserOnCondition "{params,returnObj}" -x 3
代码语言:javascript
复制
$ watch com.runlion.fsp.credit.service.impl.CreditServiceImpl listCreditAndUserOnCondition "{params,returnObj}" -x 3
Press Q or Ctrl+C to abort.
Affect(class-cnt:2 , method-cnt:2) cost in 183 ms.
ts=2019-09-03 19:29:58; [cost=336.416578ms] result=@ArrayList[
    @Object[][
        @CreditDto[
            creditId=null,
            realName=null,
            phone=null,
            relatedCompanyName=null,
            productId=null,
            deleted=null,
            startTimeF=@Date[2019-08-01 00:00:00,000],
            endTimeF=@Date[2019-09-30 23:59:59,000],
            pageNum=@Integer[1],
            pageSize=@Integer[20],
        ],
    ],
    @FspPageInfo[
        pageNum=@Integer[1],
        pageSize=@Integer[20],
        total=@Long[58],
        pages=@Integer[3],
        result=@Page[
            @CreditDetailVo[CreditDetailVo(creditId=CRED19090300001872, userName=15995055310, realName=溧阳市神马机电设备安装有限公司, phone=15995055310, userProp=1, userPropStr=供应商, userType=1, userTypeStr=企业, productId=LPRO19080800000002, productName=应收账款质押贷, relatedCompanyName=漳平红狮水泥有限公司, moneyResourceOrganizationName=null, creditTotal=46800.00, creditUsed=0.00, creditResidue=42545.45, deleted=0, deletedStr=正常, gmtCreate=Tue Sep 03 16:56:41 CST 2019, channelUserName=20500030)],
            @CreditDetailVo[CreditDetailVo(creditId=CRED19090300001871, userName=15995055310, realName=溧阳市神马机电设备安装有限公司, phone=15995055310, userProp=1, userPropStr=供应商, userType=1, userTypeStr=企业, productId=LPRO19080800000001, productName=自助贷, relatedCompanyName=漳平红狮水泥有限公司, moneyResourceOrganizationName=null, creditTotal=46800.00, creditUsed=0.00, creditResidue=42545.45, deleted=0, deletedStr=正常, gmtCreate=Tue Sep 03 16:56:41 CST 2019, channelUserName=20500030)]
4. 观察当前对象中的属性
代码语言:javascript
复制
$ watch com.runlion.fsp.credit.service.impl.CreditServiceImpl listCreditAndUserOnCondition "target" -x 3
Press Q or Ctrl+C to abort.
Affect(class-cnt:2 , method-cnt:2) cost in 189 ms.
ts=2019-09-03 19:34:52; [cost=313.479341ms] result=@CreditServiceImpl[
    log=@Logger[
        serialVersionUID=@Long[5454405123156820674],
        FQCN=@String[ch.qos.logback.classic.Logger],
        name=@String[com.runlion.fsp.credit.service.impl.CreditServiceImpl],
        level=null,
        effectiveLevelInt=@Integer[20000],
        parent=@Logger[
            serialVersionUID=@Long[5454405123156820674],
            FQCN=@String[ch.qos.logback.classic.Logger],
            name=@String[com.runlion.fsp.credit.service.impl],
            level=null,
            effectiveLevelInt=@Integer[20000],
            parent=@Logger[Logger[com.runlion.fsp.credit.service]],
            childrenList=@CopyOnWriteArrayList[isEmpty=false;size=5],
            aai=null,
            additive=@Boolean[true],
            loggerContext=@LoggerContext[ch.qos.logback.classic.LoggerContext[default]],
        ],
        childrenList=null,
        aai=null,
        additive=@Boolean[true],
在这里插入图片描述
在这里插入图片描述
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2019-09-03 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 本文介绍:watch的使用
  • 7.watch命令
    • 1. 监控com.runlion.fsp.credit.service.impl.CreditServiceImpl 类的listCreditAndUserOnCondition方法返回值,及方法耗时:
      • 2. 我们注意最后一个,指定属性遍历深度,刚才的遍历深度没有指定,默认为1,所以没有具体到数据,我们设置为3看一下:
        • 3. 我们同时监控入参和出参:
          • 4. 观察当前对象中的属性
          领券
          问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档