use of com.navercorp.pinpoint.bootstrap.context.SpanRecorder in project pinpoint by naver.
the class HttpStatusCodeRecorderTest method record.
@Test
public void record() throws Exception {
final SpanRecorder spanRecorder = mock(SpanRecorder.class);
HttpStatusCodeErrors errors = new HttpStatusCodeErrors(Arrays.asList("5xx", "401", "402"));
HttpStatusCodeRecorder recorder = new HttpStatusCodeRecorder(errors);
recorder.record(spanRecorder, 500);
recorder.record(spanRecorder, 200);
recorder.record(spanRecorder, 404);
// illegal argument.
recorder.record(null, 500);
recorder.record(spanRecorder, 0);
recorder.record(spanRecorder, -1);
recorder.record(spanRecorder, 999);
}
use of com.navercorp.pinpoint.bootstrap.context.SpanRecorder in project pinpoint by naver.
the class TBaseProcessorProcessInterceptor method finalizeSpan.
private void finalizeSpan(final Trace trace, String methodUri, Throwable throwable) {
try {
finalizeSpanEvent(trace, null, throwable);
SpanRecorder recorder = trace.getSpanRecorder();
recorder.recordRpcName(methodUri);
} catch (Throwable t) {
logger.warn("Error processing trace object. Cause:{}", t.getMessage(), t);
} finally {
trace.close();
}
}
use of com.navercorp.pinpoint.bootstrap.context.SpanRecorder in project pinpoint by naver.
the class TBaseAsyncProcessorProcessInterceptor method processTraceObject.
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);
}
use of com.navercorp.pinpoint.bootstrap.context.SpanRecorder in project pinpoint by naver.
the class AsyncListenerInterceptorHelper method recordHttpStatusCode.
private void recordHttpStatusCode(final Trace trace, final int statusCode) {
// Record http status code
final SpanRecorder spanRecorder = trace.getSpanRecorder();
this.httpStatusCodeRecorder.record(spanRecorder, statusCode);
}
use of com.navercorp.pinpoint.bootstrap.context.SpanRecorder in project pinpoint by naver.
the class SpanSimpleAroundInterceptor method before.
@Override
public void before(Object target, Object[] args) {
if (isDebug) {
logger.beforeInterceptor(target, args);
}
try {
final Trace trace = createTrace(target, args);
if (trace == null) {
return;
}
// TODO STATDISABLE this logic was added to disable statistics tracing
if (!trace.canSampled()) {
return;
}
// ------------------------------------------------------
final SpanRecorder recorder = trace.getSpanRecorder();
doInBeforeTrace(recorder, target, args);
} catch (Throwable th) {
if (logger.isWarnEnabled()) {
logger.warn("BEFORE. Caused:{}", th.getMessage(), th);
}
}
}
Aggregations