@Override public void verifyServerTraces(PluginTestVerifier verifier) throws Exception { final InetSocketAddress actualServerAddress = super.environment.getServerAddress(); verifier.verifyTraceCount(2); Method process = TBaseAsyncProcessor.class.getDeclaredMethod("process", AsyncFrameBuffer.class); // RootSpan verifier.verifyTrace(root("THRIFT_SERVER", // ServiceType, "Thrift Server Invocation", // Method "com/navercorp/pinpoint/plugin/thrift/dto/EchoService/echo", // rpc actualServerAddress.getHostName() + ":" + actualServerAddress.getPort(), // endPoint actualServerAddress.getHostName() // remoteAddress )); // SpanEvent - TBaseAsyncProcessor.process verifier.verifyTrace(event("THRIFT_SERVER_INTERNAL", process)); verifier.verifyTraceCount(0); }
@Override public void before(Object target, Object[] args) { if (isDebug) { logger.beforeInterceptor(target, args); } // process(final AsyncFrameBuffer fb) if (args.length != 1) { return; } // Set server markers if (args[0] instanceof AsyncFrameBuffer) { AsyncFrameBuffer frameBuffer = (AsyncFrameBuffer)args[0]; attachMarkersToInputProtocol(frameBuffer.getInputProtocol(), true); } }
@Override public void after(Object target, Object[] args, Object result, Throwable throwable) { if (isDebug) { logger.afterInterceptor(target, args, result, throwable); } // Unset server markers if (args[0] instanceof AsyncFrameBuffer) { AsyncFrameBuffer frameBuffer = (AsyncFrameBuffer)args[0]; attachMarkersToInputProtocol(frameBuffer.getInputProtocol(), false); } final Trace trace = this.traceContext.currentRawTraceObject(); if (trace == null) { return; } this.traceContext.removeTraceObject(); if (trace.canSampled()) { try { processTraceObject(trace, target, args, throwable); } catch (Throwable t) { logger.warn("Error processing trace object. Cause:{}", t.getMessage(), t); } finally { trace.close(); } } }
public AsyncMethodCallback<Void> getResultHandler( final AsyncFrameBuffer fb, final int seqid) { final org.apache.thrift.AsyncProcessFunction fcall = this; return new AsyncMethodCallback<Void>() { public void onComplete(Void o) { } public void onError(Exception e) { } }; }