Search in sources :

Example 1 with PluginJar

use of com.navercorp.pinpoint.profiler.plugin.PluginJar in project pinpoint by naver.

the class ConfigModule method configure.

@Override
protected void configure() {
    logger.info("configure {}", this.getClass().getSimpleName());
    binder().requireExplicitBindings();
    binder().requireAtInjectOnConstructors();
    binder().disableCircularProxies();
    ProfilerConfig profilerConfig = agentOption.getProfilerConfig();
    bind(ProfilerConfig.class).toInstance(profilerConfig);
    Properties properties = profilerConfig.getProperties();
    ConfigurationLoader configurationLoader = new ConfigurationLoader(properties);
    ContextConfig contextConfig = new DefaultContextConfig();
    configurationLoader.load(contextConfig);
    logger.info("{}", contextConfig);
    bind(ContextConfig.class).toInstance(contextConfig);
    bindConstants(contextConfig);
    PluginLoadingConfig pluginLoadingConfig = new DefaultPluginLoadingConfig();
    configurationLoader.load(pluginLoadingConfig);
    logger.info("{}", pluginLoadingConfig);
    bind(PluginLoadingConfig.class).toInstance(pluginLoadingConfig);
    InstrumentConfig instrumentConfig = new DefaultInstrumentConfig();
    configurationLoader.load(instrumentConfig);
    logger.info("{}", instrumentConfig);
    bind(InstrumentConfig.class).toInstance(instrumentConfig);
    InstrumentMatcherCacheConfig instrumentMatcherCacheConfig = new DefaultInstrumentMatcherCacheConfig();
    configurationLoader.load(instrumentMatcherCacheConfig);
    logger.info("{}", instrumentMatcherCacheConfig);
    bind(InstrumentMatcherCacheConfig.class).toInstance(instrumentMatcherCacheConfig);
    MonitorConfig monitorConfig = new DefaultMonitorConfig();
    configurationLoader.load(monitorConfig);
    logger.info("{}", monitorConfig);
    bind(MonitorConfig.class).toInstance(monitorConfig);
    bind(TransportModule.class).toInstance(profilerConfig.getTransportModule());
    bind(Instrumentation.class).toInstance(agentOption.getInstrumentation());
    bind(InterceptorRegistryBinder.class).toProvider(InterceptorRegistryBinderProvider.class).in(Scopes.SINGLETON);
    TypeLiteral<List<String>> pluginJarFile = new TypeLiteral<List<String>>() {
    };
    bind(pluginJarFile).annotatedWith(PluginJarPaths.class).toInstance(agentOption.getPluginJars());
    TypeLiteral<List<PluginJar>> pluginJars = new TypeLiteral<List<PluginJar>>() {
    };
    bind(pluginJars).annotatedWith(PluginJars.class).toProvider(PluginJarsProvider.class).in(Scopes.SINGLETON);
    bindBootstrapCoreInformation();
    bindAgentInformation(agentOption.getAgentId(), agentOption.getAgentName(), agentOption.getApplicationName(), agentOption.isContainer());
    bindShutdownHook(contextConfig);
}
Also used : PluginJarPaths(com.navercorp.pinpoint.profiler.context.module.PluginJarPaths) TransportModule(com.navercorp.pinpoint.bootstrap.config.TransportModule) ProfilerConfig(com.navercorp.pinpoint.bootstrap.config.ProfilerConfig) InterceptorRegistryBinderProvider(com.navercorp.pinpoint.profiler.context.provider.InterceptorRegistryBinderProvider) Instrumentation(java.lang.instrument.Instrumentation) DefaultInstrumentMatcherCacheConfig(com.navercorp.pinpoint.profiler.instrument.config.DefaultInstrumentMatcherCacheConfig) DefaultMonitorConfig(com.navercorp.pinpoint.profiler.context.monitor.config.DefaultMonitorConfig) Properties(java.util.Properties) DefaultPluginLoadingConfig(com.navercorp.pinpoint.profiler.plugin.config.DefaultPluginLoadingConfig) PluginLoadingConfig(com.navercorp.pinpoint.profiler.plugin.config.PluginLoadingConfig) ContextConfig(com.navercorp.pinpoint.profiler.context.config.ContextConfig) DefaultContextConfig(com.navercorp.pinpoint.profiler.context.config.DefaultContextConfig) DefaultInstrumentMatcherCacheConfig(com.navercorp.pinpoint.profiler.instrument.config.DefaultInstrumentMatcherCacheConfig) InstrumentMatcherCacheConfig(com.navercorp.pinpoint.profiler.instrument.config.InstrumentMatcherCacheConfig) PluginJar(com.navercorp.pinpoint.profiler.plugin.PluginJar) TypeLiteral(com.google.inject.TypeLiteral) PluginJarsProvider(com.navercorp.pinpoint.profiler.context.provider.plugin.PluginJarsProvider) InstrumentConfig(com.navercorp.pinpoint.profiler.instrument.config.InstrumentConfig) DefaultInstrumentConfig(com.navercorp.pinpoint.profiler.instrument.config.DefaultInstrumentConfig) DefaultPluginLoadingConfig(com.navercorp.pinpoint.profiler.plugin.config.DefaultPluginLoadingConfig) List(java.util.List) DefaultContextConfig(com.navercorp.pinpoint.profiler.context.config.DefaultContextConfig) DefaultInstrumentConfig(com.navercorp.pinpoint.profiler.instrument.config.DefaultInstrumentConfig) MonitorConfig(com.navercorp.pinpoint.profiler.context.monitor.config.MonitorConfig) DefaultMonitorConfig(com.navercorp.pinpoint.profiler.context.monitor.config.DefaultMonitorConfig)

Example 2 with PluginJar

use of com.navercorp.pinpoint.profiler.plugin.PluginJar in project pinpoint by naver.

the class JarProfilerPluginClassInjectorTest method getMockPlugin.

private Plugin<?> getMockPlugin(Class<?> clazz) throws Exception {
    final URL location = CodeSourceUtils.getCodeLocation(clazz);
    logger.debug("url:{}", location);
    PluginJar pluginJar = PluginJar.fromFilePath(location.getFile());
    return new JarPlugin<>(pluginJar, Collections.emptyList(), Collections.<String>emptyList());
}
Also used : PluginJar(com.navercorp.pinpoint.profiler.plugin.PluginJar) JarPlugin(com.navercorp.pinpoint.profiler.plugin.JarPlugin) URL(java.net.URL)

Example 3 with PluginJar

use of com.navercorp.pinpoint.profiler.plugin.PluginJar in project pinpoint by naver.

the class PluginJarsProvider method sort.

private List<PluginJar> sort(List<PluginJar> pluginList, List<String> orderedPluginIdList) {
    Map<String, PluginJar> orderedPlugins = getOrderedPlugins(orderedPluginIdList);
    List<PluginJar> unorderedPlugins = new ArrayList<>();
    for (PluginJar pluginJar : pluginList) {
        String pluginId = pluginJar.getPluginId();
        if (orderedPlugins.containsKey(pluginId)) {
            PluginJar prev = orderedPlugins.put(pluginId, pluginJar);
            if (prev != null) {
                throw new IllegalStateException("Duplicate order found for plugin : " + pluginId);
            }
        } else {
            unorderedPlugins.add(pluginJar);
        }
    }
    List<PluginJar> pluginJars = new ArrayList<>();
    for (PluginJar orderedPlugin : orderedPlugins.values()) {
        if (orderedPlugin != null) {
            pluginJars.add(orderedPlugin);
        }
    }
    pluginJars.addAll(unorderedPlugins);
    return pluginJars;
}
Also used : PluginJar(com.navercorp.pinpoint.profiler.plugin.PluginJar) ArrayList(java.util.ArrayList)

Example 4 with PluginJar

use of com.navercorp.pinpoint.profiler.plugin.PluginJar in project pinpoint by naver.

the class PluginJarsProvider method filter.

private List<PluginJar> filter(List<String> pluginJarPaths, PluginFilter pluginFilter) {
    List<PluginJar> list = new ArrayList<>();
    for (String pluginJarPath : pluginJarPaths) {
        PluginJar pluginJar = PluginJar.fromFilePath(pluginJarPath);
        if (!pluginFilter.accept(pluginJar)) {
            continue;
        }
        list.add(pluginJar);
    }
    return list;
}
Also used : PluginJar(com.navercorp.pinpoint.profiler.plugin.PluginJar) ArrayList(java.util.ArrayList)

Aggregations

PluginJar (com.navercorp.pinpoint.profiler.plugin.PluginJar)4 ArrayList (java.util.ArrayList)2 TypeLiteral (com.google.inject.TypeLiteral)1 ProfilerConfig (com.navercorp.pinpoint.bootstrap.config.ProfilerConfig)1 TransportModule (com.navercorp.pinpoint.bootstrap.config.TransportModule)1 ContextConfig (com.navercorp.pinpoint.profiler.context.config.ContextConfig)1 DefaultContextConfig (com.navercorp.pinpoint.profiler.context.config.DefaultContextConfig)1 PluginJarPaths (com.navercorp.pinpoint.profiler.context.module.PluginJarPaths)1 DefaultMonitorConfig (com.navercorp.pinpoint.profiler.context.monitor.config.DefaultMonitorConfig)1 MonitorConfig (com.navercorp.pinpoint.profiler.context.monitor.config.MonitorConfig)1 InterceptorRegistryBinderProvider (com.navercorp.pinpoint.profiler.context.provider.InterceptorRegistryBinderProvider)1 PluginJarsProvider (com.navercorp.pinpoint.profiler.context.provider.plugin.PluginJarsProvider)1 DefaultInstrumentConfig (com.navercorp.pinpoint.profiler.instrument.config.DefaultInstrumentConfig)1 DefaultInstrumentMatcherCacheConfig (com.navercorp.pinpoint.profiler.instrument.config.DefaultInstrumentMatcherCacheConfig)1 InstrumentConfig (com.navercorp.pinpoint.profiler.instrument.config.InstrumentConfig)1 InstrumentMatcherCacheConfig (com.navercorp.pinpoint.profiler.instrument.config.InstrumentMatcherCacheConfig)1 JarPlugin (com.navercorp.pinpoint.profiler.plugin.JarPlugin)1 DefaultPluginLoadingConfig (com.navercorp.pinpoint.profiler.plugin.config.DefaultPluginLoadingConfig)1 PluginLoadingConfig (com.navercorp.pinpoint.profiler.plugin.config.PluginLoadingConfig)1 Instrumentation (java.lang.instrument.Instrumentation)1