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);
}
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();
}
}
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);
}
}
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);
}
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;
}
Aggregations