From ab2aec1b5f0144f9bcaf5c74e66abc1e916803d7 Mon Sep 17 00:00:00 2001 From: Harrison Date: Thu, 16 Nov 2023 16:32:53 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20REPORT-106669=20=E6=8A=A5=E8=A1=A8?= =?UTF-8?q?=E5=9F=8B=E7=82=B9=E8=A1=A5=E5=85=85=20-=20=E8=80=83=E8=99=91?= =?UTF-8?q?=E6=8F=92=E4=BB=B6=E5=BB=B6=E8=BF=9F=E5=8A=A0=E8=BD=BD=E7=9A=84?= =?UTF-8?q?=E6=83=85=E5=86=B5=EF=BC=8C=E6=8D=A2=E4=B8=80=E7=A7=8D=E6=96=B9?= =?UTF-8?q?=E5=BC=8F=E8=AE=B0=E5=BD=95=E4=BF=A1=E6=81=AF=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/fr/design/EnvChangeEntrance.java | 29 ++++++++++++------- .../module/DesignerWorkspaceActivator.java | 4 +-- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java index 91b23007ef..8eb4a9afb7 100644 --- a/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java +++ b/designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java @@ -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 切换状态 + * 见 实现 */ - 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); + }); }); } diff --git a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceActivator.java b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceActivator.java index 3813edcdbd..2fd4a532c8 100644 --- a/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceActivator.java +++ b/designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceActivator.java @@ -33,7 +33,7 @@ public class DesignerWorkspaceActivator extends Activator { private void recordModuleStop() { - WorkspaceSwitchProcess process = WorkContext.getSwitcher().getProgress(); + WorkspaceSwitchProcess process = WorkContext.getSwitcher().getProcess(); Optional.ofNullable(process) .ifPresent((e) -> e.recordModuleStopUsed(() -> { FineModule module = (FineModule) ModuleContext.getModule(EnvBasedModule.class); @@ -53,7 +53,7 @@ public class DesignerWorkspaceActivator extends Activator { private void recordModuleStart() { - WorkspaceSwitchProcess process = WorkContext.getSwitcher().getProgress(); + WorkspaceSwitchProcess process = WorkContext.getSwitcher().getProcess(); Optional.ofNullable(process) .ifPresent((e) -> e.recordModuleStartUsed(() -> { FineModule module = (FineModule) ModuleContext.getModule(EnvBasedModule.class);