use of com.alipay.sofa.boot.startup.ContextRefreshStageStat in project sofa-boot by alipay.
the class StartupSpringContextInstallStage method doProcess.
@Override
protected void doProcess() throws Exception {
contextRefreshStageStat = new ContextRefreshStageStat();
contextRefreshStageStat.setStageName(ISLE_SPRING_CONTEXT_INSTALL_STAGE);
contextRefreshStageStat.setStageStartTime(System.currentTimeMillis());
try {
super.doProcess();
} finally {
contextRefreshStageStat.setStageEndTime(System.currentTimeMillis());
startupReporter.addCommonStartupStat(contextRefreshStageStat);
}
}
use of com.alipay.sofa.boot.startup.ContextRefreshStageStat in project sofa-boot by alipay.
the class StartupContextRefreshedListener method onApplicationEvent.
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
if (applicationContext.equals(event.getApplicationContext())) {
try {
startupReporter = applicationContext.getBean(StartupReporter.class);
} catch (NoSuchBeanDefinitionException e) {
// just happen in unit tests
SofaLogger.warn("Failed to found bean StartupReporter", e);
return;
}
// init ContextRefreshStageStat
ContextRefreshStageStat stageStat = new ContextRefreshStageStat();
stageStat.setStageName(APPLICATION_CONTEXT_REFRESH_STAGE);
stageStat.setStageEndTime(System.currentTimeMillis());
// build root ModuleStat
ModuleStat rootModuleStat = new ModuleStat();
rootModuleStat.setModuleName(ROOT_MODULE_NAME);
rootModuleStat.setModuleEndTime(stageStat.getStageEndTime());
rootModuleStat.setThreadName(Thread.currentThread().getName());
// getBeanStatList from BeanCostBeanPostProcessor
BeanCostBeanPostProcessor beanCostBeanPostProcessor = applicationContext.getBean(BeanCostBeanPostProcessor.class);
rootModuleStat.setBeanStats((beanCostBeanPostProcessor.getBeanStatList()));
// report ContextRefreshStageStat
stageStat.setModuleStats(Collections.singletonList(rootModuleStat));
startupReporter.addCommonStartupStat(stageStat);
}
}
Aggregations