Browse Source

feat: REPORT-106669 报表埋点补充

- 考虑插件延迟加载的情况,换一种方式记录信息。
feature/x
Harrison 1 year ago
parent
commit
ab2aec1b5f
  1. 29
      designer-base/src/main/java/com/fr/design/EnvChangeEntrance.java
  2. 4
      designer-realize/src/main/java/com/fr/start/module/DesignerWorkspaceActivator.java

29
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 切换状态
* <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);
});
});
}

4
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);

Loading…
Cancel
Save