use of com.shulie.instrument.simulator.module.model.trace2.TraceView in project LinkAgent by shulieTech.
the class TraceListener method afterReturning.
@Override
public void afterReturning(Advice advice) throws Throwable {
Object resultObj = advice.getReturnObj();
Throwable throwable = advice.getThrowable();
TraceView traceView = traceViewThreadLocal.get();
if (throwable != null) {
traceView.getCurrent().setErrorMsg(ResultSerializer.serializeObject(throwable, 2));
} else if (resultObj != null) {
traceView.getCurrent().setResult(ResultSerializer.serializeObject(resultObj, 2));
}
if (traceView.currentIsRoot()) {
traceView.setTotalCost(traceView.getRootCost());
traceView.setClassloader(traceView.getRoot() == null ? null : traceView.getRoot().getClassloader());
TraceInfo traceInfo = ThreadUtil.getTraceInfo(Thread.currentThread());
if (traceInfo != null) {
traceView.setClusterTestAfter(traceInfo.isClusterTest());
}
rootTrace(advice, traceView);
traceViewThreadLocal.remove();
} else {
traceView.end();
}
}
use of com.shulie.instrument.simulator.module.model.trace2.TraceView in project LinkAgent by shulieTech.
the class TraceListener method before.
@Override
public void before(Advice advice) throws Throwable {
TraceView traceView;
if ((traceView = traceViewThreadLocal.get()) == null) {
traceView = new TraceView(advice.getTargetClass().getName(), advice.getBehavior().getName(), advice.getClassLoader().toString());
TraceInfo traceInfo = ThreadUtil.getTraceInfo(Thread.currentThread());
if (traceInfo != null) {
traceView.setTraceId(traceInfo.getTraceId());
traceView.setRpcId(traceInfo.getRpcId());
traceView.setClusterTestBefore(traceInfo.isClusterTest());
}
Object[] args = advice.getParameterArray();
// beforeCall在这之前调用,已经设置了current了
traceView.getCurrent().setArgs(ResultSerializer.serializeObject(args, 2));
traceViewThreadLocal.set(traceView);
} else {
if (traceView.getCurrent().getClassName().equals(advice.getTargetClass().getName()) && traceView.getCurrent().getMethodName().equals(advice.getBehavior().getName()) && StackEvent.LINE_CALL.equals(traceView.lastStage())) {
traceView.appendMethodCall();
} else {
traceView.begin(advice.getTargetClass().getName(), advice.getBehavior().getName(), advice.getClassLoader().toString(), StackEvent.METHOD_CALL);
}
}
Object[] args = advice.getParameterArray();
// beforeCall在这之前调用,已经设置了current了
traceView.getCurrent().setArgs(ResultSerializer.serializeObject(args, 2));
}
use of com.shulie.instrument.simulator.module.model.trace2.TraceView in project LinkAgent by shulieTech.
the class TraceListener method afterCallThrowing.
@Override
public void afterCallThrowing(final Advice advice, final int callLineNum, final boolean isInterface, final String callJavaClassName, final String callJavaMethodName, final String callJavaMethodDesc, final Throwable callThrowable) {
TraceView traceView = traceViewThreadLocal.get();
traceView.getCurrent().setErrorMsg(ResultSerializer.serializeObject(callThrowable, 2));
traceView.end();
}
use of com.shulie.instrument.simulator.module.model.trace2.TraceView in project LinkAgent by shulieTech.
the class TraceListener method beforeCall.
@Override
public void beforeCall(final Advice advice, final int callLineNum, final boolean isInterface, final String callJavaClassName, final String callJavaMethodName, final String callJavaMethodDesc) {
TraceView traceView = traceViewThreadLocal.get();
traceView.begin(callJavaClassName, callJavaMethodName, advice.getClassLoader().toString(), StackEvent.LINE_CALL).setLine(callLineNum);
// addNextLevelTrace(traceView.getCurrent());
}
use of com.shulie.instrument.simulator.module.model.trace2.TraceView in project LinkAgent by shulieTech.
the class TraceListener method afterCallReturning.
@Override
public void afterCallReturning(final Advice advice, final int callLineNum, final boolean isInterface, final String callJavaClassName, final String callJavaMethodName, final String callJavaMethodDesc) {
// afterReturning有可能在这之前调用,已经设置了current了
TraceView traceView = traceViewThreadLocal.get();
traceView.end();
}
Aggregations