use of com.navercorp.pinpoint.bootstrap.context.SpanEventRecorder in project pinpoint by naver.
the class ServletInvocationInterceptor method recordCookie.
private void recordCookie(HttpServletRequest request, Trace trace) {
if (cookieSampler.isSampling()) {
final SpanEventRecorder recorder = trace.currentSpanEventRecorder();
Map<String, Object> cookies = ReadCookieMap(request);
recorder.recordAttribute(AnnotationKey.HTTP_COOKIE, cookies);
}
return;
}
use of com.navercorp.pinpoint.bootstrap.context.SpanEventRecorder in project pinpoint by naver.
the class BeanMethodInterceptorTest method testAfter.
@Test
public void testAfter() throws Exception {
final MockTraceContext traceContext = new MockTraceContext();
final Trace trace = Mockito.mock(Trace.class);
traceContext.setTrace(trace);
final SpanEventRecorder recorder = Mockito.mock(SpanEventRecorder.class);
Mockito.when(trace.currentSpanEventRecorder()).thenReturn(recorder);
final BeanMethodInterceptor beanMethodInterceptor = new BeanMethodInterceptor(traceContext, true);
Object thisObject = new Object();
final Exception throwable = new Exception();
beanMethodInterceptor.after(thisObject, 10, null, null, throwable);
Mockito.verify(recorder, times(1)).recordException(true, throwable);
}
use of com.navercorp.pinpoint.bootstrap.context.SpanEventRecorder in project pinpoint by naver.
the class TProtocolReadMessageEndInterceptor method recordTrace.
private void recordTrace(Object target, ThriftRequestProperty parentTraceInfo, String methodName) {
final Trace trace = createTrace(target, parentTraceInfo, methodName);
if (trace == null) {
return;
}
if (!trace.canSampled()) {
return;
}
SpanEventRecorder recorder = trace.traceBlockBegin();
recorder.recordServiceType(ThriftConstants.THRIFT_SERVER_INTERNAL);
}
use of com.navercorp.pinpoint.bootstrap.context.SpanEventRecorder in project pinpoint by naver.
the class RequestStartAsyncInterceptor method after.
@Override
public void after(Object target, Object[] args, Object result, Throwable throwable) {
if (isDebug) {
logger.afterInterceptor(target, "", descriptor.getMethodName(), "", args);
}
final Trace trace = traceContext.currentTraceObject();
if (trace == null) {
return;
}
try {
SpanEventRecorder recorder = trace.currentSpanEventRecorder();
if (validate(target, result, throwable)) {
((AsyncAccessor) target)._$PINPOINT$_setAsync(Boolean.TRUE);
// make asynchronous trace-id
final AsyncTraceId asyncTraceId = trace.getAsyncTraceId();
recorder.recordNextAsyncId(asyncTraceId.getAsyncId());
// result is BasicFuture
// type check validate()
((AsyncTraceIdAccessor) result)._$PINPOINT$_setAsyncTraceId(asyncTraceId);
if (isDebug) {
logger.debug("Set asyncTraceId metadata {}", asyncTraceId);
}
}
recorder.recordServiceType(TomcatConstants.TOMCAT_METHOD);
recorder.recordApi(descriptor);
recorder.recordException(throwable);
} catch (Throwable t) {
logger.warn("Failed to AFTER process. {}", t.getMessage(), t);
} finally {
trace.traceBlockEnd();
}
}
use of com.navercorp.pinpoint.bootstrap.context.SpanEventRecorder in project pinpoint by naver.
the class VertxImplExecuteBlockingInterceptor method before.
@Override
public void before(Object target, Object[] args) {
if (isDebug) {
logger.beforeInterceptor(target, args);
}
Trace trace = traceContext.currentTraceObject();
if (trace == null) {
return;
}
final SpanEventRecorder recorder = trace.traceBlockBegin();
if (validate(args, 0) || validate(args, 2)) {
// make asynchronous trace-id
final AsyncTraceId asyncTraceId = trace.getAsyncTraceId();
recorder.recordNextAsyncId(asyncTraceId.getAsyncId());
if (validate(args, 0)) {
// args 0 'io.vertx.core.Handler'
((AsyncTraceIdAccessor) args[0])._$PINPOINT$_setAsyncTraceId(asyncTraceId);
}
if (validate(args, 2)) {
// args 2 'io.vertx.core.Handler'
((AsyncTraceIdAccessor) args[2])._$PINPOINT$_setAsyncTraceId(asyncTraceId);
}
if (isDebug) {
logger.debug("Set asyncTraceId metadata {}", asyncTraceId);
}
}
}
Aggregations