org.apache.skywalking.apm.agent.core.context.ContextManager Java Examples

The following examples show how to use org.apache.skywalking.apm.agent.core.context.ContextManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProducerOperationHandlerInterceptor.java    From skywalking with Apache License 2.0 6 votes vote down vote up
@Override
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
    MethodInterceptResult result) throws Throwable {
    Invocation invocation = (Invocation) allArguments[0];
    ContextCarrier contextCarrier = new ContextCarrier();
    CarrierItem next = contextCarrier.items();
    while (next.hasNext()) {
        next = next.next();
        next.setHeadValue(invocation.getContext().get(next.getHeadKey()));
    }
    String operationName = invocation.getMicroserviceQualifiedName();
    AbstractSpan span = ContextManager.createEntrySpan(operationName, contextCarrier);
    String url = invocation.getOperationMeta().getOperationPath();
    Tags.URL.set(span, url);
    span.setComponent(ComponentsDefine.SERVICECOMB);
    SpanLayer.asRPCFramework(span);
}
 
Example #2
Source File: RestHighLevelClientIndexMethodsInterceptor.java    From skywalking with Apache License 2.0 6 votes vote down vote up
@Override
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
    MethodInterceptResult result) throws Throwable {
    IndexRequest indexRequest = (IndexRequest) (allArguments[0]);

    RestClientEnhanceInfo restClientEnhanceInfo = (RestClientEnhanceInfo) (objInst.getSkyWalkingDynamicField());
    AbstractSpan span = ContextManager.createExitSpan(Constants.INDEX_OPERATOR_NAME, restClientEnhanceInfo.getPeers());
    span.setComponent(ComponentsDefine.REST_HIGH_LEVEL_CLIENT);

    Tags.DB_TYPE.set(span, DB_TYPE);
    Tags.DB_INSTANCE.set(span, indexRequest.index());
    if (TRACE_DSL) {
        Tags.DB_STATEMENT.set(span, indexRequest.toString());
    }

    SpanLayer.asDB(span);
}
 
Example #3
Source File: Struts2Interceptor.java    From skywalking with Apache License 2.0 6 votes vote down vote up
@Override
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
    MethodInterceptResult result) throws Throwable {
    HttpServletRequest request = ServletActionContext.getRequest();
    ContextCarrier contextCarrier = new ContextCarrier();

    CarrierItem next = contextCarrier.items();
    while (next.hasNext()) {
        next = next.next();
        next.setHeadValue(request.getHeader(next.getHeadKey()));
    }

    AbstractSpan span = ContextManager.createEntrySpan(request.getRequestURI(), contextCarrier);
    Tags.URL.set(span, request.getRequestURL().toString());
    Tags.HTTP.METHOD.set(span, request.getMethod());
    span.setComponent(ComponentsDefine.STRUTS2);
    SpanLayer.asHttp(span);
}
 
Example #4
Source File: SkywalkingTracerExtractInterceptor.java    From skywalking with Apache License 2.0 6 votes vote down vote up
@Override
public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
    Object ret) throws Throwable {
    Format format = (Format) allArguments[0];
    if (Format.Builtin.TEXT_MAP.equals(format) || Format.Builtin.HTTP_HEADERS.equals(format)) {
        TextMap textMapCarrier = (TextMap) allArguments[1];

        ContextCarrier contextCarrier = new ContextCarrier();
        CarrierItem next = contextCarrier.items();
        while (next.hasNext()) {
            next = next.next();
            Iterator<Map.Entry<String, String>> iterator = textMapCarrier.iterator();
            while (iterator.hasNext()) {
                Map.Entry<String, String> entry = iterator.next();
                if (next.getHeadKey().equals(entry.getKey())) {
                    next.setHeadValue(entry.getValue());
                    break;
                }
            }
        }
        ContextManager.extract(contextCarrier);
    }
    return new SkywalkingContext();
}
 
Example #5
Source File: AsyncCommandMethodInterceptor.java    From skywalking with Apache License 2.0 6 votes vote down vote up
@Override
@SuppressWarnings("unchecked")
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
    MethodInterceptResult result) throws Throwable {
    AsyncCommand asyncCommand = (AsyncCommand) objInst;
    String operationName = "Lettuce/" + asyncCommand.getType().name();
    AbstractSpan span = ContextManager.createLocalSpan(operationName + "/onComplete");
    span.setComponent(ComponentsDefine.LETTUCE);
    Tags.DB_TYPE.set(span, "Redis");
    SpanLayer.asCache(span);
    if (allArguments[0] instanceof Consumer) {
        allArguments[0] = new SWConsumer((Consumer) allArguments[0], ContextManager.capture(), operationName);
    } else {
        allArguments[0] = new SWBiConsumer((BiConsumer) allArguments[0], ContextManager.capture(), operationName);
    }
}
 
Example #6
Source File: ConstructorWithSpanBuilderInterceptor.java    From skywalking with Apache License 2.0 6 votes vote down vote up
@Override
public void onConstruct(EnhancedInstance objInst, Object[] allArguments) {
    SkywalkingSpanBuilder spanBuilder = (SkywalkingSpanBuilder) allArguments[0];

    AbstractSpan span;
    if (spanBuilder.isEntry()) {
        span = ContextManager.createEntrySpan(spanBuilder.getOperationName(), null);
    } else if (spanBuilder.isExit() && (!StringUtil.isEmpty(spanBuilder.getPeer()))) {
        span = ContextManager.createExitSpan(spanBuilder.getOperationName(), buildRemotePeer(spanBuilder));
    } else {
        span = ContextManager.createLocalSpan(spanBuilder.getOperationName());
    }

    for (Tag tag : spanBuilder.getTags()) {
        span.tag(Tags.ofKey(tag.getKey()), tag.getValue());
    }
    if (spanBuilder.isError()) {
        span.errorOccurred();
    }

    objInst.setSkyWalkingDynamicField(span);
}
 
Example #7
Source File: HandleInterceptor.java    From skywalking with Apache License 2.0 6 votes vote down vote up
@Override
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
    MethodInterceptResult result) throws Throwable {
    HttpChannel httpChannel = (HttpChannel) objInst;
    HttpServletRequest servletRequest = httpChannel.getRequest();

    ContextCarrier contextCarrier = new ContextCarrier();

    CarrierItem next = contextCarrier.items();
    while (next.hasNext()) {
        next = next.next();
        next.setHeadValue(servletRequest.getHeader(next.getHeadKey()));
    }

    AbstractSpan span = ContextManager.createEntrySpan(servletRequest.getRequestURI(), contextCarrier);
    Tags.URL.set(span, servletRequest.getRequestURL().toString());
    Tags.HTTP.METHOD.set(span, servletRequest.getMethod());
    span.setComponent(ComponentsDefine.JETTY_SERVER);
    SpanLayer.asHttp(span);
}
 
Example #8
Source File: AbstractMessageConsumeInterceptor.java    From skywalking with Apache License 2.0 6 votes vote down vote up
@Override
public final void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments,
    Class<?>[] argumentsTypes, MethodInterceptResult result) throws Throwable {
    List<MessageExt> msgs = (List<MessageExt>) allArguments[0];

    ContextCarrier contextCarrier = getContextCarrierFromMessage(msgs.get(0));
    AbstractSpan span = ContextManager.createEntrySpan(CONSUMER_OPERATION_NAME_PREFIX + msgs.get(0)
                                                                                            .getTopic() + "/Consumer", contextCarrier);

    span.setComponent(ComponentsDefine.ROCKET_MQ_CONSUMER);
    span.setLayer(SpanLayer.MQ);
    for (int i = 1; i < msgs.size(); i++) {
        ContextManager.extract(getContextCarrierFromMessage(msgs.get(i)));
    }

}
 
Example #9
Source File: SkywalkingTracerInjectInterceptor.java    From skywalking with Apache License 2.0 6 votes vote down vote up
@Override
public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
    Object ret) throws Throwable {
    Format format = (Format) allArguments[1];
    if (Format.Builtin.TEXT_MAP.equals(format) || Format.Builtin.HTTP_HEADERS.equals(format)) {
        TextMap carrier = (TextMap) allArguments[2];
        ContextCarrier contextCarrier = new ContextCarrier();
        ContextManager.inject(contextCarrier);
        CarrierItem next = contextCarrier.items();
        while (next.hasNext()) {
            next = next.next();
            carrier.put(next.getHeadKey(), next.getHeadValue());
        }
    } else {
        //Don't support other format yet.
    }

    return null;
}
 
Example #10
Source File: TracingClientCall.java    From skywalking with Apache License 2.0 6 votes vote down vote up
@Override
public void cancel(@Nullable String message, @Nullable Throwable cause) {
    final AbstractSpan span = ContextManager.createLocalSpan(operationPrefix + REQUEST_ON_CANCEL_OPERATION_NAME);
    span.setComponent(ComponentsDefine.GRPC);
    span.setLayer(SpanLayer.RPC_FRAMEWORK);
    ContextManager.continued(snapshot);

    if (cause != null) {
        span.log(cause);
    }

    try {
        super.cancel(message, cause);
    } catch (Throwable t) {
        ContextManager.activeSpan().errorOccurred().log(t);
        throw t;
    } finally {
        ContextManager.stopSpan();
    }
}
 
Example #11
Source File: TraceSegmentServiceClientTest.java    From skywalking with Apache License 2.0 6 votes vote down vote up
@Test
public void testSendTraceSegmentWithoutException() throws InvalidProtocolBufferException {
    grpcServerRule.getServiceRegistry().addService(serviceImplBase);

    AbstractSpan firstEntrySpan = ContextManager.createEntrySpan("/testFirstEntry", null);
    firstEntrySpan.setComponent(ComponentsDefine.TOMCAT);
    Tags.HTTP.METHOD.set(firstEntrySpan, "GET");
    Tags.URL.set(firstEntrySpan, "127.0.0.1:8080");
    SpanLayer.asHttp(firstEntrySpan);
    ContextManager.stopSpan();

    serviceClient.consume(storage.getTraceSegments());

    assertThat(upstreamSegments.size(), is(1));
    SegmentObject traceSegmentObject = upstreamSegments.get(0);
    assertThat(traceSegmentObject.getSpans(0).getRefsCount(), is(0));
    assertThat(traceSegmentObject.getSpansCount(), is(1));

    SpanObject spanObject = traceSegmentObject.getSpans(0);
    assertThat(spanObject.getSpanType(), is(SpanType.Entry));
    assertThat(spanObject.getSpanId(), is(0));
    assertThat(spanObject.getParentSpanId(), is(-1));
}
 
Example #12
Source File: ServiceManagerTest.java    From skywalking with Apache License 2.0 6 votes vote down vote up
@Test
public void testServiceDependencies() throws Exception {
    HashMap<Class, BootService> registryService = getFieldValue(ServiceManager.INSTANCE, "bootedServices");

    assertThat(registryService.size(), is(12));

    assertTraceSegmentServiceClient(ServiceManager.INSTANCE.findService(TraceSegmentServiceClient.class));
    assertContextManager(ServiceManager.INSTANCE.findService(ContextManager.class));
    assertGRPCChannelManager(ServiceManager.INSTANCE.findService(GRPCChannelManager.class));
    assertSamplingService(ServiceManager.INSTANCE.findService(SamplingService.class));
    assertJVMService(ServiceManager.INSTANCE.findService(JVMService.class));
    assertProfileTaskQueryService(ServiceManager.INSTANCE.findService(ProfileTaskChannelService.class));
    assertProfileTaskExecuteService(ServiceManager.INSTANCE.findService(ProfileTaskExecutionService.class));
    assertMeterRegisterService(ServiceManager.INSTANCE.findService(MeterService.class));

    assertTracingContextListener();
    assertIgnoreTracingContextListener();
    assertTracingThreadContextListener();
}
 
Example #13
Source File: TagAnnotationTest.java    From skywalking with Apache License 2.0 6 votes vote down vote up
@Test
public void testTraceWithReturnTag() throws Throwable {
    Method testMethodWithTag = TestAnnotationMethodClass.class.getDeclaredMethod("testMethodWithReturnTag", String.class, Integer.class);
    methodInterceptor.beforeMethod(enhancedInstance, testMethodWithTag, new Object[]{"lisi", 14}, null, null);
    methodInterceptor.afterMethod(enhancedInstance, testMethodWithTag, null, null, new User("lisi", 14));
    ContextManager.stopSpan();
    assertThat(storage.getTraceSegments().size(), is(1));
    TraceSegment traceSegment = storage.getTraceSegments().get(0);
    List<AbstractTracingSpan> spans = SegmentHelper.getSpans(traceSegment);
    assertThat(spans.size(), is(1));

    AbstractTracingSpan tracingSpan = spans.get(0);
    assertThat(tracingSpan.getOperationName(), is("testMethod"));
    SpanAssert.assertLogSize(tracingSpan, 0);
    SpanAssert.assertTagSize(tracingSpan, 1);
    List<TagValuePair> tags = SpanHelper.getTags(tracingSpan);

    assertThat(tags.get(0).getKey().key(), is("username"));
    assertThat(tags.get(0).getValue(), is("lisi"));

}
 
Example #14
Source File: RabbitMQConsumerInterceptor.java    From skywalking with Apache License 2.0 6 votes vote down vote up
@Override
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
    MethodInterceptResult result) throws Throwable {
    ContextCarrier contextCarrier = new ContextCarrier();
    String url = (String) objInst.getSkyWalkingDynamicField();
    Envelope envelope = (Envelope) allArguments[1];
    AMQP.BasicProperties properties = (AMQP.BasicProperties) allArguments[2];
    AbstractSpan activeSpan = ContextManager.createEntrySpan(OPERATE_NAME_PREFIX + "Topic/" + envelope.getExchange() + "Queue/" + envelope
        .getRoutingKey() + CONSUMER_OPERATE_NAME_SUFFIX, null).start(System.currentTimeMillis());
    Tags.MQ_BROKER.set(activeSpan, url);
    Tags.MQ_TOPIC.set(activeSpan, envelope.getExchange());
    Tags.MQ_QUEUE.set(activeSpan, envelope.getRoutingKey());
    activeSpan.setComponent(ComponentsDefine.RABBITMQ_CONSUMER);
    SpanLayer.asMQ(activeSpan);
    CarrierItem next = contextCarrier.items();
    while (next.hasNext()) {
        next = next.next();
        if (properties.getHeaders() != null && properties.getHeaders().get(next.getHeadKey()) != null) {
            next.setHeadValue(properties.getHeaders().get(next.getHeadKey()).toString());
        }
    }
    ContextManager.extract(contextCarrier);

}
 
Example #15
Source File: SynchronousDispatcherInterceptor.java    From skywalking with Apache License 2.0 6 votes vote down vote up
@Override
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
    MethodInterceptResult result) throws Throwable {
    HttpRequest request = (HttpRequest) allArguments[0];

    ContextCarrier contextCarrier = new ContextCarrier();
    CarrierItem next = contextCarrier.items();
    while (next.hasNext()) {
        next = next.next();
        next.setHeadValue(request.getHttpHeaders().getHeaderString(next.getHeadKey()));
    }

    AbstractSpan span = ContextManager.createEntrySpan(request.getUri().getPath(), contextCarrier);
    Tags.URL.set(span, toPath(request.getUri().getRequestUri().toString()));
    Tags.HTTP.METHOD.set(span, request.getHttpMethod());
    span.setComponent(ComponentsDefine.RESTEASY);
    SpanLayer.asHttp(span);
}
 
Example #16
Source File: ClientTracingFilterInterceptor.java    From skywalking with Apache License 2.0 6 votes vote down vote up
@Override
public void beforeMethodImpl(EnhancedInstance enhancedInstance, Method method, Object[] objects, Class<?>[] classes,
                             MethodInterceptResult methodInterceptResult) throws Throwable {
    /*
     * At this time, we can't know the operation name and peer address, so we just use placeholders here, the
     * operation name will be filled by {@link AnnotationInterceptor$Rpc} and the peer address will be filled by
     * {@link ClientDestTracingFilterInterceptor} later.
     */
    AbstractSpan finagleSpan = ContextManager.createExitSpan(PENDING_OP_NAME, "");

    finagleSpan.setComponent(FINAGLE);
    SpanLayer.asRPCFramework(finagleSpan);

    getLocalContextHolder().let(SW_SPAN, finagleSpan);
    getMarshalledContextHolder().let(SWContextCarrier$.MODULE$, new SWContextCarrier());
}
 
Example #17
Source File: TracingServerCall.java    From skywalking with Apache License 2.0 6 votes vote down vote up
@Override
public void sendMessage(RESPONSE message) {
    // We just create the request on message span for server stream calls.
    if (!getMethodDescriptor().getType().serverSendsOneMessage()) {
        final AbstractSpan span = ContextManager.createLocalSpan(operationPrefix + RESPONSE_ON_MESSAGE_OPERATION_NAME);
        span.setComponent(ComponentsDefine.GRPC);
        span.setLayer(SpanLayer.RPC_FRAMEWORK);
        ContextManager.continued(contextSnapshot);

        try {
            super.sendMessage(message);
        } catch (Throwable t) {
            ContextManager.activeSpan().errorOccurred().log(t);
            throw t;
        } finally {
            ContextManager.stopSpan();
        }
    } else {
        super.sendMessage(message);
    }
}
 
Example #18
Source File: ClientCnxnInterceptor.java    From skywalking with Apache License 2.0 5 votes vote down vote up
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
    Class<?>[] argumentsTypes, Throwable t) {
    AbstractSpan span = ContextManager.activeSpan();
    span.errorOccurred();
    span.log(t);
}
 
Example #19
Source File: PreparedStatementExecuteMethodsInterceptor.java    From skywalking with Apache License 2.0 5 votes vote down vote up
@Override
public final Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments,
                                Class<?>[] argumentsTypes, Object ret) {
    StatementEnhanceInfos cacheObject = (StatementEnhanceInfos) objInst.getSkyWalkingDynamicField();
    if (cacheObject.getConnectionInfo() != null) {
        ContextManager.stopSpan();
    }
    return ret;
}
 
Example #20
Source File: FutureCallbackWrapper.java    From skywalking with Apache License 2.0 5 votes vote down vote up
@Override
public void failed(Exception e) {
    CONTEXT_LOCAL.remove();
    if (ContextManager.isActive()) {
        ContextManager.activeSpan().errorOccurred().log(e);
        ContextManager.stopSpan();
    }
    if (callback != null) {
        callback.failed(e);
    }
}
 
Example #21
Source File: SWRunnable.java    From skywalking with Apache License 2.0 5 votes vote down vote up
@Override
public void run() {
    AbstractSpan span = ContextManager.createLocalSpan(SWRunnable.OPERATION_NAME);
    span.setComponent(ComponentsDefine.UNDERTOW);
    try {
        ContextManager.continued(snapshot);
        runnable.run();
    } finally {
        ContextManager.stopSpan();
    }
}
 
Example #22
Source File: ProxyRootInvokeInterceptor.java    From skywalking with Apache License 2.0 5 votes vote down vote up
@Override
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
    MethodInterceptResult result) {
    ContextManager.createLocalSpan("/ShardingSphere/ProxyRootInvoke/")
                  .setComponent(ComponentsDefine.SHARDING_SPHERE);
    ShardingExecuteDataMap.getDataMap().put(Constant.CONTEXT_SNAPSHOT, ContextManager.capture());
}
 
Example #23
Source File: RestExecuteInterceptor.java    From skywalking with Apache License 2.0 5 votes vote down vote up
@Override
public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
    Object ret) throws Throwable {
    Object[] cacheValues = (Object[]) objInst.getSkyWalkingDynamicField();
    cacheValues[2] = ContextManager.capture();
    if (ret != null) {
        String uri = (String) cacheValues[0];
        ((EnhancedInstance) ret).setSkyWalkingDynamicField(new EnhanceCacheObjects(uri, ComponentsDefine.SPRING_REST_TEMPLATE, SpanLayer.HTTP, (ContextSnapshot) cacheValues[2]));
    }
    ContextManager.stopSpan();
    return ret;
}
 
Example #24
Source File: GsonToJsonInterceptor.java    From skywalking with Apache License 2.0 5 votes vote down vote up
@Override
public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
    Object ret) throws Throwable {
    ContextManager.stopSpan();
    return ret;

}
 
Example #25
Source File: HandlerMethodInvokerInterceptor.java    From skywalking with Apache License 2.0 5 votes vote down vote up
@Override
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
    MethodInterceptResult result) throws Throwable {
    Object handler = allArguments[1];
    if (handler instanceof EnhancedInstance) {
        ContextManager.getRuntimeContext()
                      .put(RESPONSE_KEY_IN_RUNTIME_CONTEXT, ((NativeWebRequest) allArguments[2]).getNativeResponse());
    }
}
 
Example #26
Source File: SuccessCallbackInterceptor.java    From skywalking with Apache License 2.0 5 votes vote down vote up
@Override
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
    MethodInterceptResult result) throws Throwable {
    EnhanceCacheObjects cacheValues = (EnhanceCacheObjects) objInst.getSkyWalkingDynamicField();
    if (cacheValues == null) {
        return;
    }

    AbstractSpan span = ContextManager.createLocalSpan("future/successCallback:" + cacheValues.getOperationName());
    span.setComponent(cacheValues.getComponent()).setLayer(cacheValues.getSpanLayer());
    ContextManager.continued(cacheValues.getContextSnapshot());
}
 
Example #27
Source File: RedisConnectionMethodInterceptor.java    From skywalking with Apache License 2.0 5 votes vote down vote up
@Override
public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments,
    Class<?>[] argumentsTypes, Throwable t) {
    AbstractSpan span = ContextManager.activeSpan();
    span.errorOccurred();
    span.log(t);
}
 
Example #28
Source File: DubboInterceptor.java    From skywalking with Apache License 2.0 5 votes vote down vote up
@Override
public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
    Object ret) throws Throwable {
    Result result = (Result) ret;
    if (result != null && result.getException() != null) {
        dealException(result.getException());
    }

    ContextManager.stopSpan();
    return ret;
}
 
Example #29
Source File: AsyncAppenderBaseMethodInterceptor.java    From skywalking with Apache License 2.0 5 votes vote down vote up
@Override
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
    MethodInterceptResult result) throws Throwable {
    if (allArguments[0] instanceof EnhancedInstance) {
        EnhancedInstance instances = (EnhancedInstance) allArguments[0];
        instances.setSkyWalkingDynamicField(ContextManager.getGlobalTraceId());
    }
}
 
Example #30
Source File: MotanProviderInterceptor.java    From skywalking with Apache License 2.0 5 votes vote down vote up
@Override
public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes,
    MethodInterceptResult result) throws Throwable {
    Request request = (Request) allArguments[0];
    ContextCarrier contextCarrier = new ContextCarrier();
    CarrierItem next = contextCarrier.items();
    while (next.hasNext()) {
        next = next.next();
        next.setHeadValue(request.getAttachments().get(next.getHeadKey()));
    }

    AbstractSpan span = ContextManager.createEntrySpan(generateViewPoint(request), contextCarrier);
    SpanLayer.asRPCFramework(span);
    span.setComponent(ComponentsDefine.MOTAN);
}