Search in sources :

Example 46 with Invocation

use of com.alibaba.dubbo.rpc.Invocation in project uavstack by uavorg.

the class DubboIT method doMonitor.

public void doMonitor(Object[] args, boolean isDoCap, Throwable e) {
    Invoker<?> invoker = (Invoker<?>) args[0];
    Invocation invocation = (Invocation) args[1];
    Result result = null;
    if (isDoCap && args.length == 3) {
        result = (Result) args[2];
    }
    // consumer
    if (Constants.CONSUMER_SIDE.equals(invoker.getUrl().getParameter(Constants.SIDE_KEY))) {
        consumerCap(isDoCap, e, invoker, invocation, result);
    } else // provider
    {
        providerCap(isDoCap, e, invoker, invocation, result);
    }
}
Also used : Invoker(com.alibaba.dubbo.rpc.Invoker) Invocation(com.alibaba.dubbo.rpc.Invocation) Result(com.alibaba.dubbo.rpc.Result)

Example 47 with Invocation

use of com.alibaba.dubbo.rpc.Invocation in project uavstack by uavorg.

the class DubboConsumerAdapter method afterPreCap.

@Override
public void afterPreCap(InvokeChainContext context, Object[] args) {
    String url = (String) context.get(InvokeChainConstants.CLIENT_SPAN_THREADLOCAL_STOREKEY);
    Span span = this.spanFactory.getSpanFromContext(url);
    String spanMeta = this.spanFactory.getSpanMeta(span);
    RpcContext.getContext().setAttachment(InvokeChainConstants.PARAM_RPCHEAD_SPANINFO, spanMeta);
    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)

Aggregations

Invocation (com.alibaba.dubbo.rpc.Invocation)47 URL (com.alibaba.dubbo.common.URL)31 Test (org.junit.Test)30 Result (com.alibaba.dubbo.rpc.Result)15 Invoker (com.alibaba.dubbo.rpc.Invoker)14 RpcInvocation (com.alibaba.dubbo.rpc.RpcInvocation)14 RpcResult (com.alibaba.dubbo.rpc.RpcResult)12 DemoService (com.alibaba.dubbo.rpc.support.DemoService)11 MockInvocation (com.alibaba.dubbo.rpc.support.MockInvocation)11 MyInvoker (com.alibaba.dubbo.rpc.support.MyInvoker)10 RpcException (com.alibaba.dubbo.rpc.RpcException)9 ArrayList (java.util.ArrayList)4 Router (com.alibaba.dubbo.rpc.cluster.Router)3 BlockMyInvoker (com.alibaba.dubbo.rpc.support.BlockMyInvoker)3 IOException (java.io.IOException)3 HashMap (java.util.HashMap)3 Test (org.junit.jupiter.api.Test)3 Cache (com.alibaba.dubbo.cache.Cache)2 CacheFactory (com.alibaba.dubbo.cache.CacheFactory)2 MonitorService (com.alibaba.dubbo.monitor.MonitorService)2