Search in sources :

Example 21 with SpanRecorder

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);
}
Also used : SpanRecorder(com.navercorp.pinpoint.bootstrap.context.SpanRecorder) HttpStatusCodeErrors(com.navercorp.pinpoint.bootstrap.config.HttpStatusCodeErrors) Test(org.junit.Test)

Example 22 with SpanRecorder

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();
    }
}
Also used : SpanRecorder(com.navercorp.pinpoint.bootstrap.context.SpanRecorder)

Example 23 with SpanRecorder

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);
}
Also used : SpanRecorder(com.navercorp.pinpoint.bootstrap.context.SpanRecorder) SpanEventRecorder(com.navercorp.pinpoint.bootstrap.context.SpanEventRecorder)

Example 24 with SpanRecorder

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);
}
Also used : SpanRecorder(com.navercorp.pinpoint.bootstrap.context.SpanRecorder)

Example 25 with SpanRecorder

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);
        }
    }
}
Also used : Trace(com.navercorp.pinpoint.bootstrap.context.Trace) SpanRecorder(com.navercorp.pinpoint.bootstrap.context.SpanRecorder)

Aggregations

SpanRecorder (com.navercorp.pinpoint.bootstrap.context.SpanRecorder)38 Trace (com.navercorp.pinpoint.bootstrap.context.Trace)23 TraceId (com.navercorp.pinpoint.bootstrap.context.TraceId)10 Test (org.junit.Test)10 WrappedSpanEventRecorder (com.navercorp.pinpoint.profiler.context.recorder.WrappedSpanEventRecorder)8 Storage (com.navercorp.pinpoint.profiler.context.storage.Storage)8 TraceRoot (com.navercorp.pinpoint.profiler.context.id.TraceRoot)6 TraceContext (com.navercorp.pinpoint.bootstrap.context.TraceContext)4 TraceSampler (com.navercorp.pinpoint.bootstrap.sampler.TraceSampler)4 ActiveTraceHandle (com.navercorp.pinpoint.profiler.context.active.ActiveTraceHandle)4 DefaultSpanRecorder (com.navercorp.pinpoint.profiler.context.recorder.DefaultSpanRecorder)4 Span (com.navercorp.pinpoint.profiler.context.Span)3 DefaultTraceId (com.navercorp.pinpoint.profiler.context.id.DefaultTraceId)3 AsyncState (com.navercorp.pinpoint.bootstrap.context.AsyncState)2 SpanEventRecorder (com.navercorp.pinpoint.bootstrap.context.SpanEventRecorder)2 DefaultTraceRoot (com.navercorp.pinpoint.profiler.context.id.DefaultTraceRoot)2 ListenableAsyncState (com.navercorp.pinpoint.profiler.context.id.ListenableAsyncState)2 AMQP (com.rabbitmq.client.AMQP)2 AMQConnection (com.rabbitmq.client.impl.AMQConnection)2 HttpServletRequest (javax.servlet.http.HttpServletRequest)2