Search in sources :

Example 6 with SpanRecord

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;
}
Also used : SpanRecord(com.pamirs.pradar.interceptor.SpanRecord)

Example 7 with SpanRecord

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;
}
Also used : SpanRecord(com.pamirs.pradar.interceptor.SpanRecord) RequestIndexRename(com.pamirs.attach.plugin.es.common.RequestIndexRename) HashSet(java.util.HashSet)

Example 8 with SpanRecord

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;
}
Also used : SpanRecord(com.pamirs.pradar.interceptor.SpanRecord)

Example 9 with SpanRecord

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;
}
Also used : SpanRecord(com.pamirs.pradar.interceptor.SpanRecord)

Example 10 with SpanRecord

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;
}
Also used : SpanRecord(com.pamirs.pradar.interceptor.SpanRecord) AbstractClient(org.elasticsearch.client.support.AbstractClient) RequestIndexRename(com.pamirs.attach.plugin.es.common.RequestIndexRename) HashSet(java.util.HashSet)

Aggregations

SpanRecord (com.pamirs.pradar.interceptor.SpanRecord)199 JSONObject (com.alibaba.fastjson.JSONObject)19 SocketTimeoutException (java.net.SocketTimeoutException)15 ConsumerRecord (org.apache.kafka.clients.consumer.ConsumerRecord)13 ReflectException (com.shulie.instrument.simulator.api.reflect.ReflectException)11 HashMap (java.util.HashMap)10 List (java.util.List)8 PressureMeasureError (com.pamirs.pradar.exception.PressureMeasureError)6 Request (com.weibo.api.motan.rpc.Request)6 HeaderProcessor (com.pamirs.attach.plugin.apache.kafka.header.HeaderProcessor)5 WrapperRequest (com.pamirs.attach.plugin.hessian.common.WrapperRequest)5 URI (java.net.URI)5 HttpServletRequest (javax.servlet.http.HttpServletRequest)5 Metadata (io.grpc.Metadata)4 ServerAddress (com.mongodb.ServerAddress)3 Channel (com.rabbitmq.client.Channel)3 Connection (com.rabbitmq.client.Connection)3 Field (java.lang.reflect.Field)3 Method (java.lang.reflect.Method)3 URL (java.net.URL)3