use of com.navercorp.pinpoint.common.service.DefaultTraceMetadataLoaderService 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;
}
use of com.navercorp.pinpoint.common.service.DefaultTraceMetadataLoaderService in project pinpoint by naver.
the class AnnotationKeyTest method getCode.
@Test
public void getCode() {
TraceMetadataLoaderService typeLoaderService = new DefaultTraceMetadataLoaderService();
AnnotationKeyRegistryService annotationKeyRegistryService = new DefaultAnnotationKeyRegistryService(typeLoaderService, StdoutCommonLoggerFactory.INSTANCE);
AnnotationKey annotationKey = annotationKeyRegistryService.findAnnotationKey(AnnotationKey.API.getCode());
Assert.assertEquals(annotationKey, AnnotationKey.API);
}
Aggregations