@Override public void after(Object target, Object result, Throwable throwable, Object[] args) { if (isDebug) { logger.afterInterceptor(target, args); } final Trace trace = traceContext.currentTraceObject(); if (trace == null) { return; } try { SpanEventRecorder recorder = trace.currentSpanEventRecorder(); recorder.recordApi(methodDescriptor); recorder.recordServiceType(HttpClientConstants.HTTP_CLIENT_INTERNAL); recorder.recordException(throwable); // remove async id. InterceptorGroupInvocation transaction = interceptorGroup.getCurrentInvocation(); if (transaction != null) { // clear transaction.removeAttachment(); } } finally { trace.traceBlockEnd(); } }
@Override protected void doInAfterTrace( SpanEventRecorder recorder, Object target, Object[] args, Object result, Throwable throwable) { recorder.recordException(throwable); }
@Override protected void doInAfterTrace( SpanEventRecorder recorder, Object target, Object[] args, Object result, Throwable throwable) { DatabaseInfo databaseInfo = databaseInfoAccessor.get(target, UnKnownDatabaseInfo.INSTANCE); recorder.recordServiceType(databaseInfo.getType()); recorder.recordEndPoint(databaseInfo.getMultipleHost()); recorder.recordDestinationId(databaseInfo.getDatabaseId()); recorder.recordApi(methodDescriptor, args); recorder.recordException(throwable); }
@Override public void after(Object target, Object[] args, Object result, Throwable throwable) { if (isDebug) { logger.afterInterceptor(target, args); } final Trace trace = traceContext.currentRawTraceObject(); if (trace == null) { return; } // check user include trace. if (!isUserIncludeTrace(trace)) { return; } // leave scope(default & disable trace). if (!leaveUserIncludeTraceScope(trace)) { logger.warn( "Failed to leave scope of user include trace. trace={}, sampled={}", trace, trace.canSampled()); // delete unstable trace. deleteUserIncludeTrace(trace); return; } // check sampled. if (!trace.canSampled()) { if (isUserIncludeTraceDestination(trace)) { deleteUserIncludeTrace(trace); } return; } try { final SpanEventRecorder recorder = trace.currentSpanEventRecorder(); recorder.recordApi(descriptor); recorder.recordServiceType(ServiceType.INTERNAL_METHOD); recorder.recordException(throwable); } finally { trace.traceBlockEnd(); if (isUserIncludeTraceDestination(trace)) { deleteUserIncludeTrace(trace); } } }
private void processTraceObject( final Trace trace, Object target, Object[] args, Throwable throwable) { // end spanEvent try { // TODO Might need a way to collect and record method arguments // trace.recordAttribute(...); SpanEventRecorder recorder = trace.currentSpanEventRecorder(); recorder.recordException(throwable); recorder.recordApi(this.descriptor); } catch (Throwable t) { logger.warn("Error processing trace object. Cause:{}", t.getMessage(), t); } finally { trace.traceBlockEnd(); } // end root span SpanRecorder recorder = trace.getSpanRecorder(); String methodUri = getMethodUri(target); recorder.recordRpcName(methodUri); }
@Override public void after(Object target, Object[] args, Object result, Throwable throwable) { if (isDebug) { logger.afterInterceptor(target, args, result, throwable); } final Trace trace = this.traceContext.currentTraceObject(); if (trace == null) { return; } try { SpanEventRecorder recorder = trace.currentSpanEventRecorder(); recorder.recordApi(this.descriptor); recorder.recordException(throwable); } catch (Throwable t) { logger.warn("after error. Caused:{}", t.getMessage(), t); } finally { trace.traceBlockEnd(); } }
private void processTraceObject( final Trace trace, Object target, Object[] args, Throwable throwable) { // end spanEvent try { SpanEventRecorder recorder = trace.currentSpanEventRecorder(); // TODO Might need a way to collect and record method arguments // trace.recordAttribute(...); recorder.recordException(throwable); recorder.recordApi(this.descriptor); } catch (Throwable t) { logger.warn("Error processing trace object. Cause:{}", t.getMessage(), t); } finally { trace.traceBlockEnd(); } // end root span SpanRecorder recorder = trace.getSpanRecorder(); String methodUri = getMethodUri(target); recorder.recordRpcName(methodUri); // retrieve connection information String localIpPort = UNKNOWN_ADDRESS; String remoteAddress = UNKNOWN_ADDRESS; if (args.length == 2 && args[0] instanceof TProtocol) { TProtocol inputProtocol = (TProtocol) args[0]; if (this.socketAccessor.isApplicable(inputProtocol.getTransport())) { Socket socket = this.socketAccessor.get(inputProtocol.getTransport()); if (socket != null) { localIpPort = ThriftUtils.getHostPort(socket.getLocalSocketAddress()); remoteAddress = ThriftUtils.getHost(socket.getRemoteSocketAddress()); } } } if (localIpPort != UNKNOWN_ADDRESS) { recorder.recordEndPoint(localIpPort); } if (remoteAddress != UNKNOWN_ADDRESS) { recorder.recordRemoteAddress(remoteAddress); } }
@Override public void after(Object target, Object result, Throwable throwable, Object[] args) { if (isDebug) { logger.afterInterceptor(target, args); } Trace trace = traceContext.currentTraceObject(); if (trace == null) { return; } try { SpanEventRecorder recorder = trace.currentSpanEventRecorder(); recorder.recordApi(descriptor); recorder.recordException(throwable); if (result != null) { recorder.recordAttribute( JacksonConstants.ANNOTATION_KEY_LENGTH_VALUE, ((String) result).length()); } } finally { trace.traceBlockEnd(); } }
@Override public void after(Object target, Object[] args, Object result, Throwable throwable) { if (isDebug) { logger.afterInterceptor(target, args); } final Trace trace = traceContext.currentTraceObject(); if (trace == null) { return; } if (!validate(target)) { return; } try { SpanEventRecorder recorder = trace.currentSpanEventRecorder(); recorder.recordApi(methodDescriptor); recorder.recordException(throwable); Request request = ((UserRequestGetter) target)._$PINPOINT$_getUserRequest(); if (request != null) { recorder.recordAttribute(AnnotationKey.HTTP_URL, request.httpUrl().toString()); recorder.recordDestinationId(request.httpUrl().host() + ":" + request.httpUrl().port()); recordRequest(trace, request, throwable); } // clear attachment. InterceptorGroupInvocation invocation = interceptorGroup.getCurrentInvocation(); if (invocation != null && invocation.getAttachment() != null) { invocation.removeAttachment(); } } finally { trace.traceBlockEnd(); } }