use of com.pamirs.pradar.interceptor.SpanRecord in project LinkAgent by shulieTech.
the class ServerStreamListenerImplHalfClosedInterceptor method exceptionTrace.
@Override
public SpanRecord exceptionTrace(Advice advice) {
SpanRecord record = new SpanRecord();
if (advice.getThrowable() instanceof SocketTimeoutException) {
record.setResultCode(ResultCode.INVOKE_RESULT_TIMEOUT);
} else {
record.setResultCode(ResultCode.INVOKE_RESULT_FAILED);
}
record.setResponse(advice.getThrowable());
return record;
}
use of com.pamirs.pradar.interceptor.SpanRecord in project LinkAgent by shulieTech.
the class ServerStreamListenerImplMessagesAvailableInterceptor method afterTrace.
@Override
public SpanRecord afterTrace(Advice advice) {
SpanRecord record = new SpanRecord();
record.setResultCode(ResultCode.INVOKE_RESULT_SUCCESS);
return record;
}
use of com.pamirs.pradar.interceptor.SpanRecord in project LinkAgent by shulieTech.
the class ServerStreamListenerImplMessagesAvailableInterceptor method beforeTrace.
@Override
public SpanRecord beforeTrace(Advice advice) {
final String fullMethodName = manager.getDynamicField(advice.getTarget(), GrpcConstants.DYNAMIC_FIELD_FULL_METHOD_NAME);
final Map<String, String> invokeContext = manager.getDynamicField(advice.getTarget(), GrpcConstants.DYNAMIC_FIELD_INVOKE_CONTEXT);
SpanRecord record = new SpanRecord();
String rpcId = invokeContext.get(Pradar.getInvokeIdKey());
String[] rpcIds = rpcId.split("\\.");
String lastRpcId = Integer.valueOf(rpcIds[rpcIds.length - 1]) + 1 + "";
StringBuilder newRpcId = new StringBuilder();
for (int i = 0; i < rpcIds.length - 1; i++) {
newRpcId.append(rpcIds[i]).append(".");
}
newRpcId.append(lastRpcId);
invokeContext.put(Pradar.getInvokeIdKey(), newRpcId.toString());
record.setContext(invokeContext);
String method = fullMethodName;
String service = "";
if (fullMethodName.indexOf("/") != -1) {
service = fullMethodName.substring(0, fullMethodName.lastIndexOf("/"));
method = fullMethodName.substring(fullMethodName.lastIndexOf("/") + 1);
}
record.setMethod(method);
record.setService(service);
return record;
}
use of com.pamirs.pradar.interceptor.SpanRecord in project LinkAgent by shulieTech.
the class ServerTransportListenerImplStartCallInterceptor method afterTrace.
@Override
public SpanRecord afterTrace(Advice advice) {
SpanRecord record = new SpanRecord();
record.setResultCode(ResultCode.INVOKE_RESULT_SUCCESS);
return record;
}
use of com.pamirs.pradar.interceptor.SpanRecord in project LinkAgent by shulieTech.
the class DdlTracerInterceptor method exceptionTrace.
@Override
public SpanRecord exceptionTrace(Advice advice) {
String methodName = advice.getBehaviorName();
Object[] args = advice.getParameterArray();
SpanRecord spanRecord = new SpanRecord();
if ("createTable".equals(methodName)) {
TableDescriptor descriptor = (TableDescriptor) args[0];
spanRecord.setService(descriptor.getTableName().getNameAsString());
} else {
org.apache.hadoop.hbase.TableName tableName = (org.apache.hadoop.hbase.TableName) args[0];
spanRecord.setService(tableName.getNameAsString());
}
spanRecord.setMethod(methodName);
spanRecord.setRequest(args[0]);
spanRecord.setResponse(advice.getThrowable());
spanRecord.setResultCode(ResultCode.INVOKE_RESULT_FAILED);
return spanRecord;
}
Aggregations