use of com.pamirs.pradar.interceptor.SpanRecord in project LinkAgent by shulieTech.
the class TransportClientTraceInterceptor method exceptionTrace.
@Override
public SpanRecord exceptionTrace(Advice advice) {
Object[] args = advice.getParameterArray();
Throwable throwable = advice.getThrowable();
SpanRecord record = new SpanRecord();
record.setResultCode(ResultCode.INVOKE_RESULT_FAILED);
record.setRequest(args[1]);
record.setResponse(throwable);
return record;
}
use of com.pamirs.pradar.interceptor.SpanRecord in project LinkAgent by shulieTech.
the class HessianProxyWrapper method exceptionTrace.
public SpanRecord exceptionTrace(Object target, String methodName, Method method, Object[] args, Throwable throwable) {
if (args == null || args.length == 0) {
return null;
}
Class<?> type = getType(target, method, args);
if (type == null) {
return null;
}
SpanRecord spanRecord = new SpanRecord();
spanRecord.setService(type.getName());
spanRecord.setMethod(method.getName());
spanRecord.setRequest(args);
spanRecord.setResponse(throwable);
spanRecord.setResultCode(ResultCode.INVOKE_RESULT_FAILED);
URL url = null;
try {
url = Reflect.on(target).get(HessianConstants.DYNAMIC_FIELD_URL);
} catch (ReflectException e) {
}
if (url != null) {
String host = url.getHost();
int port = url.getPort();
if (port == 80 || port == -1) {
host = host + ":" + port;
}
spanRecord.setRemoteIp(host);
}
return spanRecord;
}
use of com.pamirs.pradar.interceptor.SpanRecord in project LinkAgent by shulieTech.
the class HessianProxyWrapper method beforeTrace.
public SpanRecord beforeTrace(Object target, String methodName, Method method, Object[] args) {
if (args == null || args.length == 0) {
return null;
}
Class<?> type = getType(target, method, args);
if (type == null) {
return null;
}
manager.setDynamicField(target, HessianConstants.DYNAMIC_FIELD_METHOD, method);
SpanRecord spanRecord = new SpanRecord();
spanRecord.setService(type.getName());
spanRecord.setMethod(method.getName());
spanRecord.setRequest(args);
URL url = null;
try {
url = Reflect.on(target).get(HessianConstants.DYNAMIC_FIELD_URL);
} catch (ReflectException e) {
}
if (url != null) {
String host = url.getHost();
int port = url.getPort();
if (port == 80 || port == -1) {
host = host + ":" + port;
}
spanRecord.setRemoteIp(host);
}
return spanRecord;
}
use of com.pamirs.pradar.interceptor.SpanRecord in project LinkAgent by shulieTech.
the class HessianProxyWrapper method afterTrace.
public SpanRecord afterTrace(Object target, String methodName, Method method, Object[] args, Object result) {
if (args == null || args.length == 0) {
return null;
}
Class<?> type = getType(target, method, args);
if (type == null) {
return null;
}
SpanRecord spanRecord = new SpanRecord();
spanRecord.setService(type.getName());
spanRecord.setMethod(method.getName());
spanRecord.setRequest(args);
spanRecord.setResponse(result);
URL url = null;
try {
url = Reflect.on(target).get(HessianConstants.DYNAMIC_FIELD_URL);
} catch (ReflectException e) {
}
if (url != null) {
String host = url.getHost();
int port = url.getPort();
if (port == 80 || port == -1) {
host = host + ":" + port;
}
spanRecord.setRemoteIp(host);
}
return spanRecord;
}
use of com.pamirs.pradar.interceptor.SpanRecord in project LinkAgent by shulieTech.
the class AliHBaseUETableInterceptor method exceptionTrace.
@Override
public SpanRecord exceptionTrace(Advice advice) {
AliHBaseUETable hTable = (AliHBaseUETable) advice.getTarget();
SpanRecord spanRecord = new SpanRecord();
String tableName = getTableName(hTable);
spanRecord.setService(tableName);
spanRecord.setMethod(advice.getBehaviorName());
spanRecord.setRequest(advice.getParameterArray()[0]);
spanRecord.setResponse(advice.getThrowable());
spanRecord.setResultCode(ResultCode.INVOKE_RESULT_FAILED);
return spanRecord;
}
Aggregations