其他分享
首页 > 其他分享> > Arthas 使用

Arthas 使用

作者:互联网

 

1 调用bean中的某个方法:

#抓取 'io.dropwizard.metrics5.ScheduledReporter.report()'
tt -t io.dropwizard.metrics5.ScheduledReporter report params.length==0 -n 1
#tt列表查看
[arthas@1463]$ tt -l INDEX TIMESTAMP COST(ms) IS-RET IS-EXP OBJECT CLASS METHOD --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 1000 2022-03-04 19:44:24 66.333827 true false 0x35edfcef GarbageFreeScheduledReporter report 1001 2022-03-04 19:58:21 214.109877 true false 0x46ae7821 GarbageFreeScheduledReporter report 1002 2022-03-04 19:58:21 215.242145 true false 0x46ae7821 InfluxDbReporter report 1003 2022-03-04 20:07:07 8.364167 true false 0x69ff4845 GarbageFreeScheduledReporter report Affect(row-cnt:4) cost in 1 ms.
#查看当前target
[arthas@1463]$ tt -i 1000 -w 'target' @HickwallUDPReporter[ logger=@DefaultLogger[com.xxx.framework.foundation.internals.logger.DefaultLogger@2a638bfe], DEFAULT_IDC=@String[DEFAULT-IDC], LOGGER=@Logger[Logger[io.dropwizard.metrics5.influxdb.InfluxDbReporter]], VALUE=@String[value], clock=@UserTimeClock[io.dropwizard.metrics5.Clock$UserTimeClock@927d5c], sender=@InfluxDbUdpSender[io.dropwizard.metrics5.influxdb.InfluxDbUdpSender@36244462], builder=@InfluxDbLineBuilder[io.dropwizard.metrics5.influxdb.InfluxDbLineBuilder@61b7166e], registry=@MetricRegistry[io.dropwizard.metrics5.MetricRegistry@57bd4ddd], mirror=@RegistryMirror[io.dropwizard.metrics5.influxdb.GarbageFreeScheduledReporter$RegistryMirror@4456b2eb], LOG=@Logger[Logger[io.dropwizard.metrics5.ScheduledReporter]], FACTORY_ID=@AtomicInteger[3], registry=@MetricRegistry[io.dropwizard.metrics5.MetricRegistry@57bd4ddd], executor=@DelegatedScheduledExecutorService[java.util.concurrent.Executors$DelegatedScheduledExecutorService@5045e957], shutdownExecutorOnStop=@Boolean[true], disabledMetricAttributes=@RegularEnumSet[isEmpty=false;size=7], scheduledFuture=@ScheduledFutureTask[java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@45c6db93[Not completed, task = java.util.concurrent.Executors$RunnableAdapter@9188157[Wrapped task = io.dropwizard.metrics5.ScheduledReporter$1@34f6f60c]]], filter=@[io.dropwizard.metrics5.MetricFilter$1@3ab69d2d], durationFactor=@Long[1000000], durationUnit=@String[milliseconds], rateFactor=@Long[1], rateUnit=@String[second], ]
#调用bean 中的stop()方法
tt -i 1000 -w 'target.stop()'

 

转自:

https://arthas.aliyun.com/doc/tt.html (官方手册)
https://github.com/alibaba/arthas/issues/482 (Alibaba Arthas实践--获取到Spring Context)

 

标签:tt,Arthas,dropwizard,report,io,使用,metrics5,true
来源: https://www.cnblogs.com/ylz8401/p/15979872.html