Search in sources :

Example 16 with PinpointException

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

the class TargetAnnotatedInterceptorInjector method createFilteredMethodEditor.

private MethodTransformer createFilteredMethodEditor(TargetFilter annotation, InstrumentClass targetClass, AnnotatedInterceptorInjector injector, ClassLoader classLoader) {
    String type = annotation.type();
    if (type == null) {
        throw new PinpointException("type of @TargetFilter is null: " + interceptorClassName);
    }
    final InterceptorArgumentProvider interceptorArgumentProvider = new InterceptorArgumentProvider(dataSourceMonitorRegistry, apiMetaDataService, targetClass);
    AutoBindingObjectFactory filterFactory = new AutoBindingObjectFactory(profilerConfig, traceContext, pluginContext, classLoader, interceptorArgumentProvider);
    MethodFilter filter = (MethodFilter) filterFactory.createInstance(ObjectFactory.byConstructor(type, (Object[]) annotation.constructorArguments()));
    MethodRecipe recipe = annotation.singleton() ? new SharedAnnotatedInterceptorInjector(injector) : injector;
    return new FilteringMethodTransformer(new MethodFilter[] { filter }, Arrays.<MethodRecipe>asList(recipe), null);
}
Also used : AutoBindingObjectFactory(com.navercorp.pinpoint.profiler.objectfactory.AutoBindingObjectFactory) MethodFilter(com.navercorp.pinpoint.bootstrap.instrument.MethodFilter) MethodRecipe(com.navercorp.pinpoint.profiler.plugin.xml.transformer.MethodRecipe) PinpointException(com.navercorp.pinpoint.exception.PinpointException) InterceptorArgumentProvider(com.navercorp.pinpoint.profiler.objectfactory.InterceptorArgumentProvider) FilteringMethodTransformer(com.navercorp.pinpoint.profiler.plugin.xml.transformer.FilteringMethodTransformer)

Example 17 with PinpointException

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

the class MatchableClassFileTransformerDelegate method transform.

@Override
public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException {
    Objects.requireNonNull(className, "className");
    final InstrumentContext instrumentContext = this.instrumentContext;
    final GuardInstrumentor guard = new GuardInstrumentor(this.profilerConfig, instrumentContext);
    try {
        // WARN external plugin api
        final TransformCallback transformCallback = transformCallbackProvider.getTransformCallback(instrumentContext, loader);
        return transformCallback.doInTransform(guard, loader, className, classBeingRedefined, protectionDomain, classfileBuffer);
    } catch (InstrumentException e) {
        throw new PinpointException(e);
    } finally {
        guard.close();
    }
}
Also used : GuardInstrumentor(com.navercorp.pinpoint.profiler.instrument.GuardInstrumentor) InstrumentException(com.navercorp.pinpoint.bootstrap.instrument.InstrumentException) PinpointException(com.navercorp.pinpoint.exception.PinpointException) InstrumentContext(com.navercorp.pinpoint.bootstrap.instrument.InstrumentContext) TransformCallback(com.navercorp.pinpoint.bootstrap.instrument.transformer.TransformCallback)

Example 18 with PinpointException

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

the class DynamicTransformCallbackProvider method getTransformCallback.

@Override
public TransformCallback getTransformCallback(InstrumentContext instrumentContext, ClassLoader loader) {
    try {
        final Class<? extends TransformCallback> transformCallbackClass = instrumentContext.injectClass(loader, transformCallbackClassName);
        Constructor<? extends TransformCallback> constructor = transformCallbackClass.getConstructor(parameterTypes);
        return constructor.newInstance(parameters);
    } catch (Exception e) {
        throw new PinpointException(transformCallbackClassName + " load fail Caused by:" + e.getMessage(), e);
    }
}
Also used : PinpointException(com.navercorp.pinpoint.exception.PinpointException) PinpointException(com.navercorp.pinpoint.exception.PinpointException)

Example 19 with PinpointException

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

the class DefaultTrace method stackDump.

private void stackDump(String caused) {
    PinpointException exception = new PinpointException(caused);
    logger.warn("[DefaultTrace] Corrupted call stack found TraceRoot:{}, CallStack:{}", getTraceRoot(), callStack, exception);
}
Also used : PinpointException(com.navercorp.pinpoint.exception.PinpointException)

Example 20 with PinpointException

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

the class DefaultTraceFactory method checkAndGet.

private Reference<Trace> checkAndGet() {
    final Reference<Trace> reference = this.threadLocalBinder.get();
    final Trace old = reference.get();
    if (old != null) {
        final PinpointException exception = new PinpointException("already Trace Object exist.");
        if (logger.isWarnEnabled()) {
            logger.warn("beforeTrace:{}", old, exception);
        }
        throw exception;
    }
    return reference;
}
Also used : Trace(com.navercorp.pinpoint.bootstrap.context.Trace) PinpointException(com.navercorp.pinpoint.exception.PinpointException)

Aggregations

PinpointException (com.navercorp.pinpoint.exception.PinpointException)25 TargetConstructor (com.navercorp.pinpoint.bootstrap.interceptor.annotation.TargetConstructor)4 TargetConstructors (com.navercorp.pinpoint.bootstrap.interceptor.annotation.TargetConstructors)4 TargetFilter (com.navercorp.pinpoint.bootstrap.interceptor.annotation.TargetFilter)4 TargetMethod (com.navercorp.pinpoint.bootstrap.interceptor.annotation.TargetMethod)4 TargetMethods (com.navercorp.pinpoint.bootstrap.interceptor.annotation.TargetMethods)4 Trace (com.navercorp.pinpoint.bootstrap.context.Trace)2 InstrumentContext (com.navercorp.pinpoint.bootstrap.instrument.InstrumentContext)2 InstrumentException (com.navercorp.pinpoint.bootstrap.instrument.InstrumentException)2 TransformCallback (com.navercorp.pinpoint.bootstrap.instrument.transformer.TransformCallback)2 GuardInstrumentor (com.navercorp.pinpoint.profiler.instrument.GuardInstrumentor)2 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 SimpleClassMetadata (com.navercorp.pinpoint.profiler.instrument.classreading.SimpleClassMetadata)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