|
|
|
@ -137,22 +137,28 @@ public class EnvChangeEntrance {
|
|
|
|
|
*/ |
|
|
|
|
private boolean switch2Env(final String envName, PopTipStrategy strategy) { |
|
|
|
|
|
|
|
|
|
WorkspaceSwitchProcess lastProcess = WorkContext.getSwitcher().getProcess(); |
|
|
|
|
PerformancePoint performancePoint = PerformancePoint.create(); |
|
|
|
|
|
|
|
|
|
boolean switchStatus = doSwitch2Env(envName, strategy); |
|
|
|
|
// 记录切换耗时
|
|
|
|
|
recordSwitchElapsed(performancePoint); |
|
|
|
|
// 触发切换埋点
|
|
|
|
|
triggerSwitchMetric(switchStatus); |
|
|
|
|
|
|
|
|
|
WorkspaceSwitchProcess currentProcess = WorkContext.getSwitcher().getProcess(); |
|
|
|
|
// 如果相同,代表根本没切换 ==
|
|
|
|
|
if (lastProcess != currentProcess) { |
|
|
|
|
// 记录切换耗时
|
|
|
|
|
recordSwitchInfos(performancePoint, switchStatus); |
|
|
|
|
// 触发切换埋点
|
|
|
|
|
triggerSwitchMetric(); |
|
|
|
|
} |
|
|
|
|
return switchStatus; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 由云端运维,触发切换埋点 |
|
|
|
|
* 内部空实现 |
|
|
|
|
* |
|
|
|
|
* @param switchStatus 切换状态 |
|
|
|
|
* 见 <a href="https://kms.fineres.com/pages/viewpage.action?pageId=945327503">实现</a> |
|
|
|
|
*/ |
|
|
|
|
private void triggerSwitchMetric(boolean switchStatus) { |
|
|
|
|
private void triggerSwitchMetric() { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -236,12 +242,15 @@ public class EnvChangeEntrance {
|
|
|
|
|
TemplateTreeClipboard.getInstance().reset(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static void recordSwitchElapsed(PerformancePoint performancePoint) { |
|
|
|
|
private static void recordSwitchInfos(PerformancePoint performancePoint, boolean switchSuccess) { |
|
|
|
|
|
|
|
|
|
performancePoint.end(elapsed -> { |
|
|
|
|
WorkspaceSwitchProcess process = WorkContext.getSwitcher().getProgress(); |
|
|
|
|
WorkspaceSwitchProcess process = WorkContext.getSwitcher().getProcess(); |
|
|
|
|
Optional.ofNullable(process) |
|
|
|
|
.ifPresent((e) -> e.recordSwitchElapsed(elapsed)); |
|
|
|
|
.ifPresent((e) -> { |
|
|
|
|
e.recordSwitchElapsed(elapsed); |
|
|
|
|
e.setSwitchSuccess(switchSuccess); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|