Search in sources :

Example 21 with SpanRecord

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

Example 22 with SpanRecord

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

Example 23 with SpanRecord

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

Example 24 with SpanRecord

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

Example 25 with SpanRecord

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;
}
Also used : SpanRecord(com.pamirs.pradar.interceptor.SpanRecord) TableDescriptor(org.apache.hadoop.hbase.client.TableDescriptor)

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