Search in sources :

Example 61 with SpanRecord

use of com.pamirs.pradar.interceptor.SpanRecord in project LinkAgent by shulieTech.

the class HessianServletServiceInterceptor method exceptionTrace.

@Override
public SpanRecord exceptionTrace(Advice advice) {
    Object[] args = advice.getParameterArray();
    Object target = advice.getTarget();
    if (args == null || args.length == 0) {
        return null;
    }
    Class<?> type = getType(target, args);
    if (type == null) {
        return null;
    }
    SpanRecord spanRecord = new SpanRecord();
    spanRecord.setResponse(advice.getThrowable());
    spanRecord.setResultCode(ResultCode.INVOKE_RESULT_FAILED);
    return spanRecord;
}
Also used : SpanRecord(com.pamirs.pradar.interceptor.SpanRecord)

Example 62 with SpanRecord

use of com.pamirs.pradar.interceptor.SpanRecord in project LinkAgent by shulieTech.

the class ClientInterceptor method afterTrace.

@Override
public SpanRecord afterTrace(Advice advice) {
    SpanRecord record = new SpanRecord();
    ClientResponse response = (ClientResponse) advice.getReturnObj();
    record.setResultCode(String.valueOf(response.getStatus()));
    InnerWhiteListCheckUtil.check();
    return record;
}
Also used : SpanRecord(com.pamirs.pradar.interceptor.SpanRecord) ClientResponse(org.glassfish.jersey.client.ClientResponse)

Example 63 with SpanRecord

use of com.pamirs.pradar.interceptor.SpanRecord in project LinkAgent by shulieTech.

the class XmemcachedInterceptor method exceptionTrace.

@Override
public SpanRecord exceptionTrace(Advice advice) {
    SpanRecord record = new SpanRecord();
    record.setResponse(advice.getThrowable());
    record.setResultCode(ResultCode.INVOKE_RESULT_FAILED);
    record.setMiddlewareName(XmemcachedConstants.MIDDLEWARE_NAME);
    return record;
}
Also used : SpanRecord(com.pamirs.pradar.interceptor.SpanRecord)

Example 64 with SpanRecord

use of com.pamirs.pradar.interceptor.SpanRecord in project LinkAgent by shulieTech.

the class XmemcachedInterceptor method beforeTrace.

@Override
public SpanRecord beforeTrace(Advice advice) {
    String methodNameExt = XmemcachedUtils.getMethodNameExt(advice.getParameterArray());
    SpanRecord record = new SpanRecord();
    record.setService(advice.getBehaviorName());
    record.setMethod(methodNameExt);
    record.setRemoteIp(null);
    record.setPort(null);
    record.setRequest(toArgs(advice.getParameterArray()));
    record.setMiddlewareName(XmemcachedConstants.MIDDLEWARE_NAME);
    return record;
}
Also used : SpanRecord(com.pamirs.pradar.interceptor.SpanRecord)

Example 65 with SpanRecord

use of com.pamirs.pradar.interceptor.SpanRecord in project LinkAgent by shulieTech.

the class DubboConsumerInterceptor method beforeTrace.

@Override
public SpanRecord beforeTrace(Advice advice) {
    final RpcInvocation invocation = (RpcInvocation) advice.getParameterArray()[0];
    final String name = getInterfaceName(invocation);
    if (isShentongEvent(name)) {
        return null;
    }
    Invoker<?> invoker = (Invoker<?>) advice.getTarget();
    if (isMonitorService(invoker)) {
        return null;
    }
    initConsumer((Invoker<?>) advice.getTarget(), invocation);
    RpcContext context = RpcContext.getContext();
    String remoteHost = context.getRemoteHost();
    if (isLocalHost(remoteHost)) {
        remoteHost = PradarCoreUtils.getLocalAddress();
    }
    SpanRecord record = new SpanRecord();
    record.setRemoteIp(remoteHost);
    record.setPort(context.getRemotePort());
    String version = getVersion(invocation);
    record.setService(buildServiceName(name, version));
    record.setMethod(context.getMethodName() + DubboUtils.getParameterTypesString(context.getParameterTypes()));
    record.setRequestSize(DubboUtils.getRequestSize());
    record.setRequest(invocation.getArguments());
    record.setPassedCheck(Boolean.parseBoolean(invocation.getAttachment(PradarService.PRADAR_WHITE_LIST_CHECK)));
    return record;
}
Also used : SpanRecord(com.pamirs.pradar.interceptor.SpanRecord)

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