Browse Source

feat: REPORT-106669 报表埋点补充

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

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

Loading…
Cancel
Save