Search in sources :

Example 1 with ServiceTypeRegistryService

use of com.navercorp.pinpoint.common.service.ServiceTypeRegistryService in project pinpoint by naver.

the class ServiceTypeRegistryMockFactory method createMockServiceTypeRegistryService.

public ServiceTypeRegistryService createMockServiceTypeRegistryService() {
    final ServiceTypeRegistryService serviceTypeRegistryService = mock(ServiceTypeRegistryService.class);
    for (ServiceType serviceType : serviceTypeMap.values()) {
        // setup serviceRegistry
        final String serviceTypeName = serviceType.getName();
        final short serviceTypeCode = serviceType.getCode();
        when(serviceTypeRegistryService.findServiceTypeByName(serviceTypeName)).thenReturn(serviceType);
        when(serviceTypeRegistryService.findServiceType(serviceTypeCode)).thenReturn(serviceType);
        when(serviceTypeRegistryService.findDesc(serviceTypeName)).thenReturn(Collections.singletonList(serviceType));
    }
    return serviceTypeRegistryService;
}
Also used : ServiceTypeRegistryService(com.navercorp.pinpoint.common.service.ServiceTypeRegistryService) ServiceType(com.navercorp.pinpoint.common.trace.ServiceType)

Example 2 with ServiceTypeRegistryService

use of com.navercorp.pinpoint.common.service.ServiceTypeRegistryService in project pinpoint by naver.

the class ServerInstanceListSerializerTest method createMapper.

private ObjectMapper createMapper() throws Exception {
    final Jackson2ObjectMapperFactoryBean factoryBean = new Jackson2ObjectMapperFactoryBean();
    final ServerInstanceSerializer serverInstanceSerializer = new ServerInstanceSerializer();
    final ServiceTypeRegistryService serviceTypeRegistryService = mockServiceTypeRegistryService();
    serverInstanceSerializer.setServiceTypeRegistryService(serviceTypeRegistryService);
    factoryBean.setHandlerInstantiator(new TestHandlerInstantiator());
    // TODO FIX spring managed object
    factoryBean.afterPropertiesSet();
    return factoryBean.getObject();
}
Also used : ServiceTypeRegistryService(com.navercorp.pinpoint.common.service.ServiceTypeRegistryService) Jackson2ObjectMapperFactoryBean(org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean)

Example 3 with ServiceTypeRegistryService

use of com.navercorp.pinpoint.common.service.ServiceTypeRegistryService in project pinpoint by naver.

the class PinpointStarter method start.

boolean start() {
    final IdValidator idValidator = new IdValidator();
    final String agentId = idValidator.getAgentId();
    if (agentId == null) {
        return false;
    }
    final String applicationName = idValidator.getApplicationName();
    if (applicationName == null) {
        return false;
    }
    URL[] pluginJars = classPathResolver.resolvePlugins();
    // TODO using PLogger instead of CommonLogger
    CommonLoggerFactory loggerFactory = StdoutCommonLoggerFactory.INSTANCE;
    TraceMetadataLoaderService typeLoaderService = new DefaultTraceMetadataLoaderService(pluginJars, loggerFactory);
    ServiceTypeRegistryService serviceTypeRegistryService = new DefaultServiceTypeRegistryService(typeLoaderService, loggerFactory);
    AnnotationKeyRegistryService annotationKeyRegistryService = new DefaultAnnotationKeyRegistryService(typeLoaderService, loggerFactory);
    String configPath = getConfigPath(classPathResolver);
    if (configPath == null) {
        return false;
    }
    // set the path of log file as a system property
    saveLogFilePath(classPathResolver);
    savePinpointVersion();
    try {
        // Is it right to load the configuration in the bootstrap?
        ProfilerConfig profilerConfig = DefaultProfilerConfig.load(configPath);
        // this is the library list that must be loaded
        List<URL> libUrlList = resolveLib(classPathResolver);
        AgentClassLoader agentClassLoader = new AgentClassLoader(libUrlList.toArray(new URL[libUrlList.size()]));
        final String bootClass = getBootClass();
        agentClassLoader.setBootClass(bootClass);
        logger.info("pinpoint agent [" + bootClass + "] starting...");
        AgentOption option = createAgentOption(agentId, applicationName, profilerConfig, instrumentation, pluginJars, bootstrapJarFile, serviceTypeRegistryService, annotationKeyRegistryService);
        Agent pinpointAgent = agentClassLoader.boot(option);
        pinpointAgent.start();
        registerShutdownHook(pinpointAgent);
        logger.info("pinpoint agent started normally.");
    } catch (Exception e) {
        // unexpected exception that did not be checked above
        logger.warn(ProductInfo.NAME + " start failed.", e);
        return false;
    }
    return true;
}
Also used : TraceMetadataLoaderService(com.navercorp.pinpoint.common.service.TraceMetadataLoaderService) DefaultTraceMetadataLoaderService(com.navercorp.pinpoint.common.service.DefaultTraceMetadataLoaderService) AnnotationKeyRegistryService(com.navercorp.pinpoint.common.service.AnnotationKeyRegistryService) DefaultAnnotationKeyRegistryService(com.navercorp.pinpoint.common.service.DefaultAnnotationKeyRegistryService) ServiceTypeRegistryService(com.navercorp.pinpoint.common.service.ServiceTypeRegistryService) DefaultServiceTypeRegistryService(com.navercorp.pinpoint.common.service.DefaultServiceTypeRegistryService) ProfilerConfig(com.navercorp.pinpoint.bootstrap.config.ProfilerConfig) DefaultProfilerConfig(com.navercorp.pinpoint.bootstrap.config.DefaultProfilerConfig) URL(java.net.URL) DefaultTraceMetadataLoaderService(com.navercorp.pinpoint.common.service.DefaultTraceMetadataLoaderService) CommonLoggerFactory(com.navercorp.pinpoint.common.util.logger.CommonLoggerFactory) StdoutCommonLoggerFactory(com.navercorp.pinpoint.common.util.logger.StdoutCommonLoggerFactory) DefaultServiceTypeRegistryService(com.navercorp.pinpoint.common.service.DefaultServiceTypeRegistryService) DefaultAnnotationKeyRegistryService(com.navercorp.pinpoint.common.service.DefaultAnnotationKeyRegistryService)

Aggregations

ServiceTypeRegistryService (com.navercorp.pinpoint.common.service.ServiceTypeRegistryService)3 DefaultProfilerConfig (com.navercorp.pinpoint.bootstrap.config.DefaultProfilerConfig)1 ProfilerConfig (com.navercorp.pinpoint.bootstrap.config.ProfilerConfig)1 AnnotationKeyRegistryService (com.navercorp.pinpoint.common.service.AnnotationKeyRegistryService)1 DefaultAnnotationKeyRegistryService (com.navercorp.pinpoint.common.service.DefaultAnnotationKeyRegistryService)1 DefaultServiceTypeRegistryService (com.navercorp.pinpoint.common.service.DefaultServiceTypeRegistryService)1 DefaultTraceMetadataLoaderService (com.navercorp.pinpoint.common.service.DefaultTraceMetadataLoaderService)1 TraceMetadataLoaderService (com.navercorp.pinpoint.common.service.TraceMetadataLoaderService)1 ServiceType (com.navercorp.pinpoint.common.trace.ServiceType)1 CommonLoggerFactory (com.navercorp.pinpoint.common.util.logger.CommonLoggerFactory)1 StdoutCommonLoggerFactory (com.navercorp.pinpoint.common.util.logger.StdoutCommonLoggerFactory)1 URL (java.net.URL)1 Jackson2ObjectMapperFactoryBean (org.springframework.http.converter.json.Jackson2ObjectMapperFactoryBean)1