Java Code Examples for org.apache.skywalking.apm.agent.core.context.ContextManager#stopSpan()
The following examples show how to use
org.apache.skywalking.apm.agent.core.context.ContextManager#stopSpan() .
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: RealCallInterceptor.java From skywalking with Apache License 2.0 | 6 votes |
/** * Get the status code from {@link Response}, when status code greater than 400, it means there was some errors in * the server. Finish the {@link AbstractSpan}. * * @param ret the method's original return value. */ @Override public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Object ret) throws Throwable { Response response = (Response) ret; if (response != null) { int statusCode = response.code(); AbstractSpan span = ContextManager.activeSpan(); if (statusCode >= 400) { span.errorOccurred(); Tags.STATUS_CODE.set(span, Integer.toString(statusCode)); } } ContextManager.stopSpan(); return ret; }
Example 2
Source File: TransportClientHandlerInterceptor.java From skywalking with Apache License 2.0 | 6 votes |
@Override public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Object ret) throws Throwable { Invocation invocation = (Invocation) allArguments[0]; if (!checkRegisterStatus(invocation)) { return ret; } AbstractSpan span = ContextManager.activeSpan(); int statusCode = invocation.getStatus().getStatusCode(); if (statusCode >= 400) { span.errorOccurred(); Tags.STATUS_CODE.set(span, Integer.toString(statusCode)); } ContextManager.stopSpan(); return ret; }
Example 3
Source File: TracingServerCallListener.java From skywalking with Apache License 2.0 | 6 votes |
@Override public void onCancel() { final AbstractSpan span = ContextManager.createLocalSpan(operationPrefix + REQUEST_ON_CANCEL_OPERATION_NAME); span.setComponent(ComponentsDefine.GRPC); span.setLayer(SpanLayer.RPC_FRAMEWORK); ContextManager.continued(contextSnapshot); try { super.onCancel(); } catch (Throwable t) { ContextManager.activeSpan().errorOccurred().log(t); throw t; } finally { ContextManager.stopSpan(); } }
Example 4
Source File: HttpClientRequestInterceptor.java From skywalking with Apache License 2.0 | 5 votes |
@Override public void beforeMethod(final EnhancedInstance objInst, final Method method, final Object[] allArguments, final Class<?>[] argumentsTypes, final MethodInterceptResult result) throws Throwable { AbstractSpan span = ContextManager.activeSpan(); URL url = new URL((String) allArguments[1]); ContextCarrier contextCarrier = new ContextCarrier(); AbstractSpan abstractSpan = ContextManager.createExitSpan( "SpringCloudGateway/sendRequest", contextCarrier, getPeer(url)); abstractSpan.prepareForAsync(); Tags.URL.set(abstractSpan, String.valueOf(allArguments[1])); abstractSpan.setComponent(SPRING_CLOUD_GATEWAY); ContextManager.stopSpan(abstractSpan); Function<? super HttpClientRequest, ? extends Publisher<Void>> handler = (Function<? super HttpClientRequest, ? extends Publisher<Void>>) allArguments[2]; allArguments[2] = new Function<HttpClientRequest, Publisher<Void>>() { @Override public Publisher<Void> apply(final HttpClientRequest httpClientRequest) { // CarrierItem next = contextCarrier.items(); if (httpClientRequest instanceof EnhancedInstance) { ((EnhancedInstance) httpClientRequest).setSkyWalkingDynamicField(next); } return handler.apply(httpClientRequest); } }; objInst.setSkyWalkingDynamicField(new EnhanceCacheObject(span, abstractSpan)); }
Example 5
Source File: CanalInterceptor.java From skywalking with Apache License 2.0 | 5 votes |
@Override public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Object ret) throws Throwable { ContextManager.stopSpan(); return ret; }
Example 6
Source File: GsonToJsonInterceptor.java From skywalking with Apache License 2.0 | 5 votes |
@Override public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Object ret) throws Throwable { ContextManager.stopSpan(); return ret; }
Example 7
Source File: MessageOrderlyConsumeInterceptor.java From skywalking with Apache License 2.0 | 5 votes |
@Override public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Object ret) throws Throwable { ConsumeOrderlyStatus status = (ConsumeOrderlyStatus) ret; if (status == ConsumeOrderlyStatus.SUSPEND_CURRENT_QUEUE_A_MOMENT) { AbstractSpan activeSpan = ContextManager.activeSpan(); activeSpan.errorOccurred(); Tags.STATUS_CODE.set(activeSpan, status.name()); } ContextManager.stopSpan(); return ret; }
Example 8
Source File: IndicesClientDeleteMethodsInterceptor.java From skywalking with Apache License 2.0 | 5 votes |
@Override public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Object ret) throws Throwable { RestClientEnhanceInfo restClientEnhanceInfo = (RestClientEnhanceInfo) (objInst.getSkyWalkingDynamicField()); if (restClientEnhanceInfo != null) { ContextManager.stopSpan(); } return ret; }
Example 9
Source File: ServerConnectionHandleMessageInterceptor.java From skywalking with Apache License 2.0 | 5 votes |
@Override public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Object ret) throws Throwable { if (allArguments[0] instanceof HttpRequest) { ContextManager.stopSpan(); } return ret; }
Example 10
Source File: SpringTestCaseHelper.java From skywalking with Apache License 2.0 | 5 votes |
public final static void createCaseHandler(HttpServletRequest request, HttpServletResponse response, CaseHandler a) throws Throwable { ContextManager.createLocalSpan("For-Test"); ContextManager.getRuntimeContext().put(Constants.REQUEST_KEY_IN_RUNTIME_CONTEXT, request); ContextManager.getRuntimeContext().put(Constants.RESPONSE_KEY_IN_RUNTIME_CONTEXT, response); a.handleCase(); ContextManager.stopSpan(); ContextManager.getRuntimeContext().remove(Constants.CONTROLLER_METHOD_STACK_DEPTH); }
Example 11
Source File: SuccessCallbackInterceptor.java From skywalking with Apache License 2.0 | 5 votes |
@Override public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Object ret) throws Throwable { EnhanceCacheObjects cacheValues = (EnhanceCacheObjects) objInst.getSkyWalkingDynamicField(); if (cacheValues == null) { return ret; } ContextManager.stopSpan(); return ret; }
Example 12
Source File: ClientInterceptor.java From skywalking with Apache License 2.0 | 5 votes |
@Override public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Object ret) throws Throwable { Response response = (Response) allArguments[1]; if (response != null && response.getException() != null) { dealException(response.getException()); } ContextManager.stopSpan(); return ret; }
Example 13
Source File: NettyRoutingFilterInterceptor.java From skywalking with Apache License 2.0 | 4 votes |
@Override public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Object ret) throws Throwable { ContextManager.stopSpan(); return ret; }
Example 14
Source File: MongoDBInterceptor.java From skywalking with Apache License 2.0 | 4 votes |
@Override public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Object ret) { ContextManager.stopSpan(); return ret; }
Example 15
Source File: RestExecuteInterceptor.java From skywalking with Apache License 2.0 | 4 votes |
@Override public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Object ret) throws Throwable { ContextManager.stopSpan(); return ret; }
Example 16
Source File: JDBCRootInvokeInterceptor.java From skywalking with Apache License 2.0 | 4 votes |
@Override public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Object ret) { ContextManager.stopSpan(); return ret; }
Example 17
Source File: ParseInterceptor.java From skywalking with Apache License 2.0 | 4 votes |
@Override public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Object ret) { ContextManager.stopSpan(); return ret; }
Example 18
Source File: NettySocketIOOnEventInterceptor.java From skywalking with Apache License 2.0 | 4 votes |
@Override public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Object ret) throws Throwable { ContextManager.stopSpan(); return ret; }
Example 19
Source File: RabbitMQProducerInterceptor.java From skywalking with Apache License 2.0 | 4 votes |
@Override public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Object ret) throws Throwable { ContextManager.stopSpan(); return ret; }
Example 20
Source File: FiberInterceptor.java From skywalking with Apache License 2.0 | 4 votes |
@Override public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Object ret) throws Throwable { ContextManager.stopSpan(); return ret; }