use of com.newrelic.agent.TracerFactoryException in project newrelic-java-agent by newrelic.
the class YmlExtensionPointCutConverter method getTracerFactory.
/**
* Instantiates a tracer factory class of the given name.
*
* @param tracerFactoryName
* @param config
* @throws TracerFactoryException
*/
public static TracerFactory getTracerFactory(String tracerFactoryName, ClassLoader classLoader, TracerFactoryConfiguration config) throws TracerFactoryException {
try {
Class clazz = classLoader.loadClass(tracerFactoryName);
String msg = MessageFormat.format("Instantiating custom tracer factory {0}", tracerFactoryName);
Agent.LOG.finest(msg);
if (TracerFactory.class.isAssignableFrom(clazz)) {
return instantiateTracerFactory(clazz, config);
} else if (MethodTracerFactory.class.isAssignableFrom(clazz)) {
return instantiateMethodTracerFactory(clazz);
} else {
throw new TracerFactoryException("Unknown tracer factory type:" + tracerFactoryName);
}
} catch (Exception ex) {
throw new TracerFactoryException("Unable to load tracer factory " + tracerFactoryName, ex);
}
}
use of com.newrelic.agent.TracerFactoryException in project newrelic-java-agent by newrelic.
the class YmlExtensionPointCutConverter method getTracerFactoryName.
private static String getTracerFactoryName(Map attrs, String prefix, boolean dispatcher, Object metricNameFormat, ClassLoader loader) {
String tracerFactoryNameString = null;
Object tracerFactoryName = attrs.get(TRACER_FACTOR_KEY);
if (tracerFactoryName != null) {
try {
TracerFactory factory = getTracerFactory(tracerFactoryName.toString(), loader, new TracerFactoryConfiguration(prefix, dispatcher, metricNameFormat, attrs));
tracerFactoryNameString = tracerFactoryName.toString();
ServiceFactory.getTracerService().registerTracerFactory(tracerFactoryNameString, factory);
} catch (TracerFactoryException ex) {
throw new RuntimeException("Unable to create tracer factory " + tracerFactoryName, ex);
}
}
return tracerFactoryNameString;
}
Aggregations