Java Code Examples for org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan#errorOccurred()
The following examples show how to use
org.apache.skywalking.apm.agent.core.context.trace.AbstractSpan#errorOccurred() .
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: HttpClientExecuteInterceptor.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 { if (allArguments[0] == null || allArguments[1] == null) { return ret; } if (ret != null) { HttpResponse response = (HttpResponse) ret; StatusLine responseStatusLine = response.getStatusLine(); if (responseStatusLine != null) { int statusCode = responseStatusLine.getStatusCode(); 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: DefaultHttpClientInterceptor.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 method intercept method * @param ret the method's original return value. * @return origin ret */ @Override public Object afterMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Object ret) { Response response = (Response) ret; if (response != null) { int statusCode = response.status(); AbstractSpan span = ContextManager.activeSpan(); if (statusCode >= 400) { span.errorOccurred(); Tags.STATUS_CODE.set(span, Integer.toString(statusCode)); } } ContextManager.stopSpan(); return ret; }
Example 3
Source File: MotanProviderInterceptor.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) ret; if (response != null && response.getException() != null) { AbstractSpan span = ContextManager.activeSpan(); span.log(response.getException()); span.errorOccurred(); } ContextManager.stopSpan(); return ret; }
Example 4
Source File: OnSuccessInterceptor.java From skywalking with Apache License 2.0 | 5 votes |
@Override public void beforeMethod(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, MethodInterceptResult result) throws Throwable { SendCallBackEnhanceInfo enhanceInfo = (SendCallBackEnhanceInfo) objInst.getSkyWalkingDynamicField(); AbstractSpan activeSpan = ContextManager.createLocalSpan(CALLBACK_OPERATION_NAME_PREFIX + enhanceInfo.getTopicId() + "/Producer/Callback"); activeSpan.setComponent(ComponentsDefine.ROCKET_MQ_PRODUCER); SendStatus sendStatus = ((SendResult) allArguments[0]).getSendStatus(); if (sendStatus != SendStatus.SEND_OK) { activeSpan.errorOccurred(); Tags.STATUS_CODE.set(activeSpan, sendStatus.name()); } ContextManager.continued(enhanceInfo.getContextSnapshot()); }
Example 5
Source File: MongoDBInterceptor.java From skywalking with Apache License 2.0 | 5 votes |
@Override public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Throwable t) { AbstractSpan activeSpan = ContextManager.activeSpan(); activeSpan.errorOccurred(); activeSpan.log(t); }
Example 6
Source File: ExecuteEventListener.java From skywalking with Apache License 2.0 | 5 votes |
private void handle(AbstractExecutionEvent event, String operation) { switch (event.getEventExecutionType()) { case BEFORE_EXECUTE: AbstractSpan span = ContextManager.createExitSpan("/SJDBC/BRANCH/" + operation, event.getDataSource()); if (ExecutorDataMap.getDataMap().containsKey(AsyncExecuteInterceptor.SNAPSHOT_DATA_KEY)) { ContextManager.continued((ContextSnapshot) ExecutorDataMap.getDataMap() .get(AsyncExecuteInterceptor.SNAPSHOT_DATA_KEY)); } Tags.DB_TYPE.set(span, "sql"); Tags.DB_INSTANCE.set(span, event.getDataSource()); Tags.DB_STATEMENT.set(span, event.getSql()); if (!event.getParameters().isEmpty()) { String variables = event.getParameters() .stream() .map(String::valueOf) .collect(Collectors.joining(",")); Tags.DB_BIND_VARIABLES.set(span, variables); } span.setComponent(ComponentsDefine.SHARDING_JDBC); SpanLayer.asDB(span); break; case EXECUTE_FAILURE: span = ContextManager.activeSpan(); span.errorOccurred(); if (event.getException().isPresent()) { span.log(event.getException().get()); } case EXECUTE_SUCCESS: ContextManager.stopSpan(); } }
Example 7
Source File: ActionMethodInterceptor.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 { HttpServletResponse response = Mvcs.getResp(); AbstractSpan span = ContextManager.activeSpan(); if (response.getStatus() >= 400) { span.errorOccurred(); Tags.STATUS_CODE.set(span, Integer.toString(response.getStatus())); } ContextManager.stopSpan(); return ret; }
Example 8
Source File: XMemcachedMethodInterceptor.java From skywalking with Apache License 2.0 | 5 votes |
@Override public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Throwable t) { AbstractSpan span = ContextManager.activeSpan(); span.errorOccurred(); span.log(t); }
Example 9
Source File: FiberInterceptor.java From skywalking with Apache License 2.0 | 5 votes |
@Override public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Throwable t) { AbstractSpan span = ContextManager.activeSpan(); span.errorOccurred(); span.log(t); }
Example 10
Source File: MessageConcurrentlyConsumeInterceptor.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 { ConsumeConcurrentlyStatus status = (ConsumeConcurrentlyStatus) ret; if (status == ConsumeConcurrentlyStatus.RECONSUME_LATER) { AbstractSpan activeSpan = ContextManager.activeSpan(); activeSpan.errorOccurred(); Tags.STATUS_CODE.set(activeSpan, status.name()); } ContextManager.stopSpan(); return ret; }
Example 11
Source File: MotanProviderInterceptor.java From skywalking with Apache License 2.0 | 5 votes |
@Override public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Throwable t) { AbstractSpan activeSpan = ContextManager.activeSpan(); activeSpan.errorOccurred(); activeSpan.log(t); }
Example 12
Source File: MemcachedMethodInterceptor.java From skywalking with Apache License 2.0 | 5 votes |
@Override public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Throwable t) { AbstractSpan span = ContextManager.activeSpan(); span.errorOccurred(); span.log(t); }
Example 13
Source File: SpanSetTagInterceptor.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 { AbstractSpan activeSpan = ContextManager.activeSpan(); String tagKey = String.valueOf(allArguments[0]); String tagValue = String.valueOf(allArguments[1]); if (Tags.PEER_SERVICE.getKey().equals(tagKey)) { activeSpan.setOperationName(tagValue); } else if (Tags.ERROR.getKey().equals(tagKey) && "true".equals(tagValue)) { activeSpan.errorOccurred(); } else { activeSpan.tag(org.apache.skywalking.apm.agent.core.context.tag.Tags.ofKey(tagKey), tagValue); } return ret; }
Example 14
Source File: ClientCnxnInterceptor.java From skywalking with Apache License 2.0 | 5 votes |
@Override public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Throwable t) { AbstractSpan span = ContextManager.activeSpan(); span.errorOccurred(); span.log(t); }
Example 15
Source File: DefaultResultSetFutureGetUninterruptiblyInterceptor.java From skywalking with Apache License 2.0 | 5 votes |
@Override public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Throwable t) { if (ContextManager.isActive()) { AbstractSpan span = ContextManager.activeSpan(); span.errorOccurred(); span.log(t); } }
Example 16
Source File: DefaultHttpClientInterceptor.java From skywalking with Apache License 2.0 | 5 votes |
@Override public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Throwable t) { AbstractSpan activeSpan = ContextManager.activeSpan(); activeSpan.log(t); activeSpan.errorOccurred(); }
Example 17
Source File: ClusterConnectInterceptor.java From skywalking with Apache License 2.0 | 5 votes |
@Override public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Throwable t) { if (ContextManager.isActive()) { AbstractSpan span = ContextManager.activeSpan(); span.errorOccurred(); span.log(t); } }
Example 18
Source File: ProducerOperationHandlerInterceptor.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 { Invocation invocation = (Invocation) allArguments[0]; 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 19
Source File: DubboInterceptor.java From skywalking with Apache License 2.0 | 4 votes |
/** * Log the throwable, which occurs in Dubbo RPC service. */ private void dealException(Throwable throwable) { AbstractSpan span = ContextManager.activeSpan(); span.errorOccurred(); span.log(throwable); }
Example 20
Source File: ResinV4Interceptor.java From java-plugin-extensions with Apache License 2.0 | 4 votes |
@Override public void handleMethodException(EnhancedInstance objInst, Method method, Object[] allArguments, Class<?>[] argumentsTypes, Throwable t) { AbstractSpan activeSpan = ContextManager.activeSpan(); activeSpan.log(t); activeSpan.errorOccurred(); }