今天想跟踪下线上hbase几个方法的调用情况,主要是HTable的get方法 public Result get(final Get get) throws IOException { return new ServerCallable<Result>(connection, tableName, get.getRow(), operationTimeout) { public Result call() throws IOException { return server.get(location.getRegionInfo().getRegionName(), get); } }.withRetries(); }a 里面有个匿名内部类,ServerCallable,先看看整体的get方法: @OnMethod( clazz="org.apache.hadoop.hbase.client.HTable", method="get", location=@Location(value=Kind.RETURN) ) public static void trawwwwwceegin(@Duration long durationL){ if(durationL>10000000){ println("more than 10 ms"); } } 输出=============================================== org.apache.hadoop.hbase.client.HTable@a622ad println("more than 10 ms"); 正常输出,发现有蛮多大于10ms的,因此想看看withRetries方法内部的一些情况 Btrace脚本: @OnMethod( clazz="org.apache.hadoop.hbase.client.ServerCallable", method="withRetries", location=@Location(value=Kind.RETURN) ) public static void tragin(@Self Object instance,@Return Object result,@Duration long durationL){ if(durationL>10000000){ println(instance); println(durationL); println(result); } } 输出如下 org.apache.hadoop.hbase.client.Result@54b34266 org.apache.hadoop.hbase.client.HTable$3@53a67d71 133527000 可以看到不能打出一个ServerCallable,而是HTable$3的实例 看withRetries里面调用call public T withRetries() { ...... for (int tries = 0; tries < numRetries; tries++) { try { beforeCall(); connect(tries != 0); return call(); } catch (Throwable t) { ..... } ...... } return null; } private static long count; @OnMethod( clazz="org.apache.hadoop.hbase.client.ServerCallable", method="withRetries", location=@Location(value=Kind.CALL, clazz="org.apache.hadoop.hbase.client.ServerCallable", method="call") ) public static void tragin(@Self Object instance1,@ProbeClassName String pcm, @ProbeMethodName String pmn,@TargetInstance Object instance, @TargetMethodOrField String method){ println(strcat("ProbeClassName: ",pcm)); println(strcat("ProbeMethodName: ",pmn)); println(strcat("TargetInstance: ",str(classOf(instance)))); println(strcat("self: ",str(classOf(instance1)))); println(strcat("TargetMethodOrField : ",str(method))); } ProbeClassName: org/apache/hadoop/hbase/client/ServerCallable ProbeMethodName: withRetries TargetInstance: class org.apache.hadoop.hbase.client.HTable$3 self: class org.apache.hadoop.hbase.client.HTable$3 TargetMethodOrField : call 可以看到Class也变成HTable$3了 |
|