Search in sources :

Example 1 with BaseConfig

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);
}
Also used : AgentHelper.getFile(com.newrelic.agent.AgentHelper.getFile) File(java.io.File) BaseConfig(com.newrelic.agent.config.BaseConfig) YamlExtension(com.newrelic.agent.extension.YamlExtension)

Example 2 with BaseConfig

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);
}
Also used : ClassMatcher(com.newrelic.agent.instrumentation.classmatchers.ClassMatcher) ExtensionClassAndMethodMatcher(com.newrelic.agent.instrumentation.custom.ExtensionClassAndMethodMatcher) BaseConfig(com.newrelic.agent.config.BaseConfig) Config(com.newrelic.agent.config.Config) BaseConfig(com.newrelic.agent.config.BaseConfig) ExtensionClassAndMethodMatcher(com.newrelic.agent.instrumentation.custom.ExtensionClassAndMethodMatcher) MethodMatcher(com.newrelic.agent.instrumentation.methodmatchers.MethodMatcher)

Aggregations

BaseConfig (com.newrelic.agent.config.BaseConfig)2 AgentHelper.getFile (com.newrelic.agent.AgentHelper.getFile)1 Config (com.newrelic.agent.config.Config)1 YamlExtension (com.newrelic.agent.extension.YamlExtension)1 ClassMatcher (com.newrelic.agent.instrumentation.classmatchers.ClassMatcher)1 ExtensionClassAndMethodMatcher (com.newrelic.agent.instrumentation.custom.ExtensionClassAndMethodMatcher)1 MethodMatcher (com.newrelic.agent.instrumentation.methodmatchers.MethodMatcher)1 File (java.io.File)1