Search in sources :

Example 1 with TraceAccessor

use of com.navercorp.pinpoint.plugin.resin.TraceAccessor in project pinpoint by naver.

the class HttpRequestInterceptor method before.

@Override
public void before(Object target, Object[] args) {
    logger.beforeInterceptor(target, target.getClass().getName(), targetMethod.getName(), "", args);
    try {
        if (target != null) {
            if (target instanceof AsyncAccessor) {
                // reset
                ((AsyncAccessor) target)._$PINPOINT$_setAsync(Boolean.FALSE);
            }
            if (target instanceof TraceAccessor) {
                final Trace trace = ((TraceAccessor) target)._$PINPOINT$_getTrace();
                if (trace != null && trace.canSampled()) {
                    // end of root span
                    trace.close();
                }
                // reset
                ((TraceAccessor) target)._$PINPOINT$_setTrace(null);
            }
        }
    } catch (Throwable t) {
        logger.warn("Failed to BEFORE process. {}", t.getMessage(), t);
    }
}
Also used : Trace(com.navercorp.pinpoint.bootstrap.context.Trace) AsyncAccessor(com.navercorp.pinpoint.plugin.resin.AsyncAccessor) TraceAccessor(com.navercorp.pinpoint.plugin.resin.TraceAccessor)

Aggregations

Trace (com.navercorp.pinpoint.bootstrap.context.Trace)1 AsyncAccessor (com.navercorp.pinpoint.plugin.resin.AsyncAccessor)1 TraceAccessor (com.navercorp.pinpoint.plugin.resin.TraceAccessor)1