use of com.navercorp.pinpoint.bootstrap.context.SpanRecorder in project pinpoint by naver.
the class ServerRequestRecorderFactoryTest method record.
@Test
public void record() throws Exception {
RequestAdaptor<ServerRequestWrapper> requestAdaptor = new ServerRequestWrapperAdaptor();
final ServerRequestRecorder<ServerRequestWrapper> recorder = new ServerRequestRecorder<>(requestAdaptor);
// SpanRecorder
SpanRecorder spanRecorder = mock(SpanRecorder.class);
recorder.record(spanRecorder, new MockServerRequestWrapper());
verify(spanRecorder).recordRpcName(RPC_NAME);
verify(spanRecorder).recordEndPoint(END_POINT);
verify(spanRecorder).recordRemoteAddress(REMOTE_ADDRESS);
verify(spanRecorder).recordAcceptorHost(GET_HEADER);
}
use of com.navercorp.pinpoint.bootstrap.context.SpanRecorder in project pinpoint by naver.
the class HttpServerResponseImplInterceptor method doInAfterTrace.
@Override
public void doInAfterTrace(SpanEventRecorder recorder, Object target, Object[] args, Object result, Throwable throwable) {
recorder.recordApi(methodDescriptor);
recorder.recordServiceType(VertxConstants.VERTX_HTTP_SERVER_INTERNAL);
recorder.recordException(throwable);
if (target instanceof HttpServerResponse) {
final HttpServerResponse response = (HttpServerResponse) target;
// TODO more simple.
final AsyncContext asyncContext = getAsyncContext(target);
if (asyncContext != null) {
final Trace trace = asyncContext.currentAsyncTraceObject();
if (trace != null) {
final SpanRecorder spanRecorder = trace.getSpanRecorder();
this.httpStatusCodeRecorder.record(spanRecorder, response.getStatusCode());
}
}
}
}
use of com.navercorp.pinpoint.bootstrap.context.SpanRecorder in project pinpoint by naver.
the class ServletResponseListener method destroyed.
public void destroyed(RESP response, final Throwable throwable, final int statusCode) {
Objects.requireNonNull(response, "response");
if (isDebug) {
logger.debug("Destroyed responseEvent. response={}, throwable={}, statusCode={}", response, throwable, statusCode);
}
final Trace trace = this.traceContext.currentRawTraceObject();
if (trace == null) {
return;
}
if (trace.canSampled()) {
final SpanRecorder spanRecorder = trace.getSpanRecorder();
this.httpStatusCodeRecorder.record(spanRecorder, statusCode);
this.serverResponseHeaderRecorder.recordHeader(spanRecorder, response);
}
}
use of com.navercorp.pinpoint.bootstrap.context.SpanRecorder in project pinpoint by naver.
the class PinpointJUnit4ClassRunner method beginTracing.
private void beginTracing(FrameworkMethod method) {
if (shouldCreateNewTraceObject(method)) {
TraceContext traceContext = getTraceContext();
Trace trace = traceContext.newTraceObject();
SpanRecorder recorder = trace.getSpanRecorder();
recorder.recordServiceType(ServiceType.TEST);
}
}
use of com.navercorp.pinpoint.bootstrap.context.SpanRecorder in project pinpoint by naver.
the class DefaultBaseTraceFactory method continueAsyncTraceObject.
// entry point async trace.
@InterfaceAudience.LimitedPrivate("vert.x")
@Override
public Trace continueAsyncTraceObject(final TraceId traceId) {
final TraceSampler.State state = traceSampler.isContinueSampled();
final boolean sampling = state.isSampled();
if (sampling) {
final TraceRoot traceRoot = traceRootFactory.continueTraceRoot(traceId, state.nextId());
final Span span = spanFactory.newSpan(traceRoot);
final SpanChunkFactory spanChunkFactory = new DefaultSpanChunkFactory(traceRoot);
final Storage storage = storageFactory.createStorage(spanChunkFactory);
final CallStack<SpanEvent> callStack = callStackFactory.newCallStack();
final ActiveTraceHandle handle = registerActiveTrace(traceRoot);
final SpanAsyncStateListener asyncStateListener = new SpanAsyncStateListener(span, storageFactory);
final AsyncState asyncState = new ListenableAsyncState(asyncStateListener, handle);
final SpanRecorder spanRecorder = recorderFactory.newSpanRecorder(span, traceId.isRoot(), sampling);
final WrappedSpanEventRecorder wrappedSpanEventRecorder = recorderFactory.newWrappedSpanEventRecorder(traceRoot, asyncState);
final DefaultTrace trace = new DefaultTrace(span, callStack, storage, sampling, spanRecorder, wrappedSpanEventRecorder, ActiveTraceHandle.EMPTY_HANDLE);
final AsyncTrace asyncTrace = new AsyncTrace(traceRoot, trace, asyncState);
return asyncTrace;
} else {
return newDisableTrace(state.nextId());
}
}
Aggregations