use of com.newrelic.agent.config.BaseConfig in project newrelic-java-agent by newrelic.
the class JmxObjectFactoryTest method createExtension.
private Extension createExtension(String path) throws Exception {
File file = getFile(path);
BaseConfig config = JmxYmlParserTest.readYml(file);
return new YamlExtension(getClass().getClassLoader(), "Test", config.getProperties(), true);
}
use of com.newrelic.agent.config.BaseConfig in project newrelic-java-agent by newrelic.
the class YmlExtensionPointCutConverter method createExtensionPointCut.
public static ExtensionClassAndMethodMatcher createExtensionPointCut(Map attrs, String defaultMetricPrefix, ClassLoader classLoader, String extName) {
ClassMatcher classMatcher = getClassMatcher(attrs);
MethodMatcher methodMatcher = getMethodMatcher(attrs);
boolean dispatcher = getDispatcher(attrs);
Config newConfig = new BaseConfig(attrs);
boolean skipTransTrace = newConfig.getProperty(SKIP_TRANS_KEY, Boolean.FALSE);
boolean ignoreTrans = newConfig.getProperty(IGNORE_TRANS_KEY, Boolean.FALSE);
String metricPrefix = defaultMetricPrefix;
String metricName;
Object format = attrs.get(METRIC_NAME_FORMAT_KEY);
if (format instanceof String) {
metricName = format.toString();
} else if (null == format) {
metricName = null;
} else if (format instanceof MetricNameFormatFactory) {
// sorry - not supported anymore
Agent.LOG.log(Level.WARNING, MessageFormat.format("The object property {0} is no longer supported in the agent. The default naming mechanism will be used.", METRIC_NAME_FORMAT_KEY));
metricName = null;
} else {
throw new RuntimeException(MessageFormat.format("Unsupported {0} value", METRIC_NAME_FORMAT_KEY));
}
String tracerFactoryNameString = getTracerFactoryName(attrs, defaultMetricPrefix, dispatcher, format, classLoader);
String nameOfExtension = (extName == null) ? "Unknown" : extName;
return new ExtensionClassAndMethodMatcher(nameOfExtension, metricName, metricPrefix, classMatcher, methodMatcher, dispatcher, skipTransTrace, false, ignoreTrans, tracerFactoryNameString);
}
Aggregations