Search in sources :

Example 6 with PinpointException

use of com.navercorp.pinpoint.exception.PinpointException in project pinpoint by naver.

the class DefaultTrace method traceBlockBegin.

@Override
public SpanEventRecorder traceBlockBegin(final int stackId) {
    // Set properties for the case when stackFrame is not used as part of Span.
    final SpanEvent spanEvent = new SpanEvent(span);
    spanEvent.markStartTime();
    spanEvent.setStackId(stackId);
    if (this.closed) {
        if (isWarn) {
            PinpointException exception = new PinpointException("already closed trace.");
            logger.warn("[DefaultTrace] Corrupted call stack found.", exception);
        }
    } else {
        callStack.push(spanEvent);
    }
    return wrappedSpanEventRecorder(spanEvent);
}
Also used : PinpointException(com.navercorp.pinpoint.exception.PinpointException)

Example 7 with PinpointException

use of com.navercorp.pinpoint.exception.PinpointException in project pinpoint by naver.

the class DefaultTrace method currentSpanEventRecorder.

@Override
public SpanEventRecorder currentSpanEventRecorder() {
    SpanEvent spanEvent = callStack.peek();
    if (spanEvent == null) {
        if (isWarn) {
            PinpointException exception = new PinpointException("call stack is empty");
            logger.warn("[DefaultTrace] Corrupted call stack found.", exception);
        }
        // make dummy.
        spanEvent = new SpanEvent(span);
    }
    return wrappedSpanEventRecorder(spanEvent);
}
Also used : PinpointException(com.navercorp.pinpoint.exception.PinpointException)

Example 8 with PinpointException

use of com.navercorp.pinpoint.exception.PinpointException in project pinpoint by naver.

the class DefaultTrace method close.

@Override
public void close() {
    if (closed) {
        logger.warn("Already closed trace.");
        return;
    }
    closed = true;
    if (!callStack.empty()) {
        if (isWarn) {
            PinpointException exception = new PinpointException("not empty call stack.");
            logger.warn("[DefaultTrace] Corrupted call stack found.", exception);
        }
    // skip
    } else {
        if (span.isTimeRecording()) {
            span.markAfterTime();
        }
        logSpan(span);
    }
    this.storage.close();
}
Also used : PinpointException(com.navercorp.pinpoint.exception.PinpointException)

Example 9 with PinpointException

use of com.navercorp.pinpoint.exception.PinpointException in project pinpoint by naver.

the class JavassistClass method addInterceptor0.

private int addInterceptor0(String interceptorClassName, Object[] constructorArgs, InterceptorScope scope, ExecutionPolicy executionPolicy) throws InstrumentException {
    int interceptorId = -1;
    final Class<?> interceptorType = pluginContext.injectClass(classLoader, interceptorClassName);
    final TargetMethods targetMethods = interceptorType.getAnnotation(TargetMethods.class);
    if (targetMethods != null) {
        for (TargetMethod m : targetMethods.value()) {
            interceptorId = addInterceptor0(m, interceptorClassName, constructorArgs, scope, executionPolicy);
        }
    }
    final TargetMethod targetMethod = interceptorType.getAnnotation(TargetMethod.class);
    if (targetMethod != null) {
        interceptorId = addInterceptor0(targetMethod, interceptorClassName, constructorArgs, scope, executionPolicy);
    }
    final TargetConstructors targetConstructors = interceptorType.getAnnotation(TargetConstructors.class);
    if (targetConstructors != null) {
        for (TargetConstructor c : targetConstructors.value()) {
            interceptorId = addInterceptor0(c, interceptorClassName, scope, executionPolicy, constructorArgs);
        }
    }
    final TargetConstructor targetConstructor = interceptorType.getAnnotation(TargetConstructor.class);
    if (targetConstructor != null) {
        interceptorId = addInterceptor0(targetConstructor, interceptorClassName, scope, executionPolicy, constructorArgs);
    }
    final TargetFilter targetFilter = interceptorType.getAnnotation(TargetFilter.class);
    if (targetFilter != null) {
        interceptorId = addInterceptor0(targetFilter, interceptorClassName, scope, executionPolicy, constructorArgs);
    }
    if (interceptorId == -1) {
        throw new PinpointException("No target is specified. At least one of @Targets, @TargetMethod, @TargetConstructor, @TargetFilter must present. interceptor: " + interceptorClassName);
    }
    return interceptorId;
}
Also used : TargetConstructors(com.navercorp.pinpoint.bootstrap.interceptor.annotation.TargetConstructors) TargetMethod(com.navercorp.pinpoint.bootstrap.interceptor.annotation.TargetMethod) TargetMethods(com.navercorp.pinpoint.bootstrap.interceptor.annotation.TargetMethods) PinpointException(com.navercorp.pinpoint.exception.PinpointException) TargetConstructor(com.navercorp.pinpoint.bootstrap.interceptor.annotation.TargetConstructor) TargetFilter(com.navercorp.pinpoint.bootstrap.interceptor.annotation.TargetFilter)

Example 10 with PinpointException

use of com.navercorp.pinpoint.exception.PinpointException in project pinpoint by naver.

the class DebugTransformerClassInjector method injectClass.

@Override
@SuppressWarnings("unchecked")
public <T> Class<? extends T> injectClass(ClassLoader classLoader, String className) {
    ClassLoader targetClassLoader = getClassLoader(classLoader);
    targetClassLoader = filterBootstrapPackage(targetClassLoader, className);
    try {
        return (Class<? extends T>) targetClassLoader.loadClass(className);
    } catch (ClassNotFoundException e) {
        throw new PinpointException("ClassNo class " + className + " with classLoader " + classLoader, e);
    }
}
Also used : PinpointException(com.navercorp.pinpoint.exception.PinpointException)

Aggregations

PinpointException (com.navercorp.pinpoint.exception.PinpointException)14 TargetConstructor (com.navercorp.pinpoint.bootstrap.interceptor.annotation.TargetConstructor)3 TargetConstructors (com.navercorp.pinpoint.bootstrap.interceptor.annotation.TargetConstructors)3 TargetFilter (com.navercorp.pinpoint.bootstrap.interceptor.annotation.TargetFilter)3 TargetMethod (com.navercorp.pinpoint.bootstrap.interceptor.annotation.TargetMethod)3 TargetMethods (com.navercorp.pinpoint.bootstrap.interceptor.annotation.TargetMethods)3 FilteringMethodTransformer (com.navercorp.pinpoint.profiler.plugin.xml.transformer.FilteringMethodTransformer)2 InstrumentClass (com.navercorp.pinpoint.bootstrap.instrument.InstrumentClass)1 MethodFilter (com.navercorp.pinpoint.bootstrap.instrument.MethodFilter)1 ByStaticFactoryMethod (com.navercorp.pinpoint.bootstrap.plugin.ObjectFactory.ByStaticFactoryMethod)1 AutoBindingObjectFactory (com.navercorp.pinpoint.profiler.objectfactory.AutoBindingObjectFactory)1 InterceptorArgumentProvider (com.navercorp.pinpoint.profiler.objectfactory.InterceptorArgumentProvider)1 ClassCookBook (com.navercorp.pinpoint.profiler.plugin.xml.transformer.ClassCookBook)1 DedicatedMethodTransformer (com.navercorp.pinpoint.profiler.plugin.xml.transformer.DedicatedMethodTransformer)1 MethodRecipe (com.navercorp.pinpoint.profiler.plugin.xml.transformer.MethodRecipe)1 MethodTransformer (com.navercorp.pinpoint.profiler.plugin.xml.transformer.MethodTransformer)1 File (java.io.File)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Method (java.lang.reflect.Method)1 URL (java.net.URL)1