use of com.navercorp.pinpoint.bootstrap.context.SpanRecorder in project pinpoint by naver.
the class SpanSimpleAroundInterceptor method after.
@Override
public void after(Object target, Object[] args, Object result, Throwable throwable) {
if (isDebug) {
logger.afterInterceptor(target, args, result, throwable);
}
final Trace trace = traceContext.currentRawTraceObject();
if (trace == null) {
return;
}
// TODO STATDISABLE this logic was added to disable statistics tracing
if (!trace.canSampled()) {
traceContext.removeTraceObject();
return;
}
// ------------------------------------------------------
try {
final SpanRecorder recorder = trace.getSpanRecorder();
doInAfterTrace(recorder, target, args, result, throwable);
} catch (Throwable th) {
if (logger.isWarnEnabled()) {
logger.warn("AFTER. Caused:{}", th.getMessage(), th);
}
} finally {
traceContext.removeTraceObject();
deleteTrace(trace, target, args, result, throwable);
}
}
use of com.navercorp.pinpoint.bootstrap.context.SpanRecorder in project pinpoint by naver.
the class ServletRequestListener method createTrace.
private Trace createTrace(REQ request) {
final String requestURI = requestAdaptor.getRpcName(request);
if (this.excludeUrlFilter.filter(requestURI)) {
if (isTrace) {
logger.trace("Filter requestURI={}", requestURI);
}
return null;
}
final Trace trace = this.requestTraceReader.read(request);
if (trace.canSampled()) {
final SpanRecorder recorder = trace.getSpanRecorder();
// record root span
recorder.recordServiceType(this.serviceType);
recorder.recordApi(SERVLET_SYNC_METHOD_DESCRIPTOR);
this.serverRequestRecorder.record(recorder, request);
// record proxy HTTP header.
this.proxyRequestRecorder.record(recorder, request);
}
return trace;
}
use of com.navercorp.pinpoint.bootstrap.context.SpanRecorder in project pinpoint by naver.
the class ServerConnectionHandleRequestInterceptor method createTrace.
private Trace createTrace(final HttpServerRequest request) {
final String requestURI = request.path();
if (requestURI != null && excludeUrlFilter.filter(requestURI)) {
// skip request.
if (isTrace) {
logger.trace("filter requestURI:{}", requestURI);
}
return null;
}
final Trace trace = this.requestTraceReader.read(request);
if (trace.canSampled()) {
final SpanRecorder recorder = trace.getSpanRecorder();
// root
recorder.recordServiceType(VertxConstants.VERTX_HTTP_SERVER);
recorder.recordApi(VERTX_HTTP_SERVER_METHOD_DESCRIPTOR);
this.serverRequestRecorder.record(recorder, request);
// record proxy HTTP header.
this.proxyRequestRecorder.record(recorder, request);
}
if (!initScope(trace)) {
// invalid scope.
deleteTrace(trace);
return null;
}
return trace;
}
use of com.navercorp.pinpoint.bootstrap.context.SpanRecorder in project pinpoint by naver.
the class DefaultTraceTest method newTrace.
private Trace newTrace(final int maxCallStackDepth) {
when(traceRoot.getShared()).thenReturn(shared);
TraceId traceId = new DefaultTraceId(agentId, agentStartTime, 0);
when(traceRoot.getTraceId()).thenReturn(traceId);
CallStackFactory<SpanEvent> callStackFactory = new CallStackFactoryV1(maxCallStackDepth, -1);
CallStack<SpanEvent> callStack = callStackFactory.newCallStack();
SpanFactory spanFactory = new DefaultSpanFactory();
Storage storage = mock(Storage.class);
final Span span = spanFactory.newSpan(traceRoot);
final boolean root = span.getTraceRoot().getTraceId().isRoot();
final SpanRecorder spanRecorder = new DefaultSpanRecorder(span, root, true, stringMetaDataService, sqlMetaDataService, errorHandler);
final WrappedSpanEventRecorder wrappedSpanEventRecorder = new WrappedSpanEventRecorder(traceRoot, asyncContextFactory, stringMetaDataService, sqlMetaDataService, errorHandler);
return new DefaultTrace(span, callStack, storage, true, spanRecorder, wrappedSpanEventRecorder, ActiveTraceHandle.EMPTY_HANDLE);
}
use of com.navercorp.pinpoint.bootstrap.context.SpanRecorder in project pinpoint by naver.
the class DisableTraceTest method testSpanRecorder.
@Test
public void testSpanRecorder() {
Trace trace = newTrace();
Trace childTrace = newChildTrace();
SpanRecorder spanRecorder = trace.getSpanRecorder();
SpanRecorder childSpanRecorder = childTrace.getSpanRecorder();
Assert.assertNull(spanRecorder);
Assert.assertNull(childSpanRecorder);
}
Aggregations