use of com.pamirs.pradar.interceptor.SpanRecord in project LinkAgent by shulieTech.
the class RestClientTraceInterceptor method afterTrace.
@Override
public SpanRecord afterTrace(Advice advice) {
Object[] args = advice.getParameterArray();
Object result = advice.getReturnObj();
SpanRecord record = new SpanRecord();
record.setResultCode(ResultCode.INVOKE_RESULT_SUCCESS);
record.setRequest(args[0]);
// record.setResponse(result);
return record;
}
use of com.pamirs.pradar.interceptor.SpanRecord in project LinkAgent by shulieTech.
the class RestClientTraceInterceptor method beforeTrace.
@Override
public SpanRecord beforeTrace(Advice advice) {
Object[] args = advice.getParameterArray();
Object target = advice.getTarget();
SpanRecord record = new SpanRecord();
RequestIndexRename requestIndexRename = RequestIndexRenameProvider.get(args[0]);
if (requestIndexRename == null) {
LOGGER.error("elasticsearch {} is not supported", args[0].getClass().getName());
return null;
}
final Set<String> indexes = new HashSet<String>(requestIndexRename.getIndex(args[0]));
if (CollectionUtils.isEmpty(indexes)) {
return null;
}
record.setService(toString(indexes));
record.setMethod(advice.getBehaviorName());
String remoteIp = getRemoteIp(target);
record.setRemoteIp(remoteIp);
if (!Pradar.isClusterTest()) {
record.setPassedCheck(true);
}
return record;
}
use of com.pamirs.pradar.interceptor.SpanRecord in project LinkAgent by shulieTech.
the class RestClientTraceInterceptor 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[0]);
record.setResponse(throwable);
return record;
}
use of com.pamirs.pradar.interceptor.SpanRecord in project LinkAgent by shulieTech.
the class RestHighLevelClientInterceptor 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[0]);
record.setResponse(throwable);
return record;
}
use of com.pamirs.pradar.interceptor.SpanRecord in project LinkAgent by shulieTech.
the class TransportClientTraceInterceptor method beforeTrace.
@Override
public SpanRecord beforeTrace(Advice advice) {
Object[] args = advice.getParameterArray();
Object target = advice.getTarget();
SpanRecord record = new SpanRecord();
RequestIndexRename requestIndexRename = RequestIndexRenameProvider.get(args[1]);
if (requestIndexRename == null) {
LOGGER.error("elasticsearch {} is not supported", args[1].getClass().getName());
return null;
}
if (!Pradar.isClusterTest()) {
record.setPassedCheck(true);
}
AbstractClient client = (AbstractClient) target;
record.setService(toString(new HashSet<String>(requestIndexRename.getIndex(args[1]))));
record.setMethod(advice.getBehaviorName());
record.setRemoteIp(parseAddressAndPort(client));
return record;
}
Aggregations