Search in sources :

Example 6 with Span

use of com.creditease.uav.apm.invokechain.span.Span in project uavstack by uavorg.

the class DubboConsumerAdapter method afterDoCap.

@Override
public void afterDoCap(InvokeChainContext context, Object[] args) {
    if (UAVServer.instance().isExistSupportor("com.creditease.uav.apm.supporters.SlowOperSupporter")) {
        Span span = (Span) context.get(InvokeChainConstants.PARAM_SPAN_KEY);
        if (span == null) {
            return;
        }
        SlowOperContext slowOperContext = new SlowOperContext();
        // 根据返回码确定当前是否有异常(由于IT位置已经解析过,此处直接使用)
        int respCode = (Integer) context.get(CaptureConstants.INFO_CLIENT_RESPONSECODE);
        if (respCode == -1) {
            slowOperContext.put(SlowOperConstants.PROTOCOL_METHOD_RETURN, parseReturn(context.get(CaptureConstants.INFO_CLIENT_RESPONSESTATE)));
        } else {
            Result result = (Result) args[2];
            slowOperContext.put(SlowOperConstants.PROTOCOL_METHOD_RETURN, parseReturn(result.getValue()));
        }
        Object[] params = { span, slowOperContext };
        UAVServer.instance().runSupporter("com.creditease.uav.apm.supporters.SlowOperSupporter", "runCap", span.getEndpointInfo().split(",")[0], InvokeChainConstants.CapturePhase.DOCAP, context, params);
    }
}
Also used : SlowOperContext(com.creditease.uav.apm.slowoper.spi.SlowOperContext) Span(com.creditease.uav.apm.invokechain.span.Span) Result(com.alibaba.dubbo.rpc.Result)

Example 7 with Span

use of com.creditease.uav.apm.invokechain.span.Span in project uavstack by uavorg.

the class DubboProviderAdapter method afterDoCap.

@Override
public void afterDoCap(InvokeChainContext context, Object[] args) {
    if (UAVServer.instance().isExistSupportor("com.creditease.uav.apm.supporters.SlowOperSupporter")) {
        String url = (String) context.get(CaptureConstants.INFO_APPSERVER_CONNECTOR_REQUEST_URL);
        Span span = this.spanFactory.getRemoveSpanFromContext(url);
        if (span == null) {
            return;
        }
        SlowOperContext slowOperContext = new SlowOperContext();
        // 根据返回码确定当前是否有异常(由于IT位置已经解析过,此处直接使用)
        String respCode = (String) context.get(CaptureConstants.INFO_APPSERVER_CONNECTOR_RESPONSECODE);
        if (respCode.equals("-1")) {
            slowOperContext.put(SlowOperConstants.PROTOCOL_METHOD_RETURN, parseReturn(context.get(CaptureConstants.INFO_APPSERVER_CONNECTOR_RESPONSESTATE)));
        } else {
            Result result = (Result) args[2];
            slowOperContext.put(SlowOperConstants.PROTOCOL_METHOD_RETURN, parseReturn(result.getValue()));
        }
        Object[] params = { span, slowOperContext };
        UAVServer.instance().runSupporter("com.creditease.uav.apm.supporters.SlowOperSupporter", "runCap", span.getEndpointInfo().split(",")[0], InvokeChainConstants.CapturePhase.DOCAP, context, params);
    }
}
Also used : SlowOperContext(com.creditease.uav.apm.slowoper.spi.SlowOperContext) Span(com.creditease.uav.apm.invokechain.span.Span) Result(com.alibaba.dubbo.rpc.Result)

Example 8 with Span

use of com.creditease.uav.apm.invokechain.span.Span in project uavstack by uavorg.

the class DubboProviderAdapter method afterPreCap.

@Override
public void afterPreCap(InvokeChainContext context, Object[] args) {
    String url = (String) context.get(CaptureConstants.INFO_APPSERVER_CONNECTOR_REQUEST_URL);
    Span span = this.spanFactory.getSpanFromContext(url);
    if (UAVServer.instance().isExistSupportor("com.creditease.uav.apm.supporters.SlowOperSupporter")) {
        SlowOperContext slowOperContext = new SlowOperContext();
        // dubbo虽属于rpc,但从其使用方式上属于方法级
        Invocation invocation = (Invocation) args[1];
        slowOperContext.put(SlowOperConstants.PROTOCOL_METHOD_PARAMS, parseParams(invocation.getArguments()));
        Object[] params = { span, slowOperContext };
        UAVServer.instance().runSupporter("com.creditease.uav.apm.supporters.SlowOperSupporter", "runCap", span.getEndpointInfo().split(",")[0], InvokeChainConstants.CapturePhase.PRECAP, context, params);
    }
}
Also used : SlowOperContext(com.creditease.uav.apm.slowoper.spi.SlowOperContext) Invocation(com.alibaba.dubbo.rpc.Invocation) Span(com.creditease.uav.apm.invokechain.span.Span)

Example 9 with Span

use of com.creditease.uav.apm.invokechain.span.Span in project uavstack by uavorg.

the class RocketMQPushConsumerAdapter method afterDoCap.

@Override
public void afterDoCap(InvokeChainContext context, Object[] args) {
    if (UAVServer.instance().isExistSupportor("com.creditease.uav.apm.supporters.SlowOperSupporter")) {
        Span span = (Span) context.get(InvokeChainConstants.PARAM_SPAN_KEY);
        if (span == null) {
            return;
        }
        Object[] params = { span };
        UAVServer.instance().runSupporter("com.creditease.uav.apm.supporters.SlowOperSupporter", "runCap", span.getEndpointInfo().split(",")[0], InvokeChainConstants.CapturePhase.DOCAP, context, params);
    }
}
Also used : Span(com.creditease.uav.apm.invokechain.span.Span)

Example 10 with Span

use of com.creditease.uav.apm.invokechain.span.Span in project uavstack by uavorg.

the class RocketMQPushConsumerAdapter method beforeDoCap.

@Override
public void beforeDoCap(InvokeChainContext context, Object[] args) {
    String storeKey = (String) context.get(InvokeChainConstants.CLIENT_SPAN_THREADLOCAL_STOREKEY);
    Span span = this.spanFactory.getSpanFromContext(storeKey);
    if (span != null) {
        span.setClassName((String) context.get(InvokeChainConstants.CLIENT_IT_CLASS));
        span.setMethodName((String) context.get(InvokeChainConstants.CLIENT_IT_METHOD));
    }
}
Also used : Span(com.creditease.uav.apm.invokechain.span.Span)

Aggregations

Span (com.creditease.uav.apm.invokechain.span.Span)37 SlowOperContext (com.creditease.uav.apm.slowoper.spi.SlowOperContext)20 DataLogger (com.creditease.monitor.log.DataLogger)6 SlowOperSpan (com.creditease.uav.apm.slowoper.span.SlowOperSpan)4 UnsupportedEncodingException (java.io.UnsupportedEncodingException)4 Invocation (com.alibaba.dubbo.rpc.Invocation)2 Result (com.alibaba.dubbo.rpc.Result)2 AMQP (com.rabbitmq.client.AMQP)2 BasicProperties (com.rabbitmq.client.AMQP.BasicProperties)2 IOException (java.io.IOException)2 HashMap (java.util.HashMap)2 List (java.util.List)2 Map (java.util.Map)2 HttpMethod (org.apache.commons.httpclient.HttpMethod)2 Header (org.apache.http.Header)2 HttpEntity (org.apache.http.HttpEntity)2 HttpRequest (org.apache.http.HttpRequest)2 HttpResponse (org.apache.http.HttpResponse)2 BufferedHttpEntity (org.apache.http.entity.BufferedHttpEntity)2 Message (com.alibaba.rocketmq.common.message.Message)1