|
|
@ -9,10 +9,10 @@ import com.fr.event.Event; |
|
|
|
import com.fr.event.EventDispatcher; |
|
|
|
import com.fr.event.EventDispatcher; |
|
|
|
import com.fr.event.Listener; |
|
|
|
import com.fr.event.Listener; |
|
|
|
import com.fr.general.CloudCenter; |
|
|
|
import com.fr.general.CloudCenter; |
|
|
|
|
|
|
|
import com.fr.general.GeneralUtils; |
|
|
|
import com.fr.general.http.HttpToolbox; |
|
|
|
import com.fr.general.http.HttpToolbox; |
|
|
|
import com.fr.json.JSONObject; |
|
|
|
import com.fr.json.JSONObject; |
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
import com.fr.log.FineLoggerFactory; |
|
|
|
import com.fr.stable.ProductConstants; |
|
|
|
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
import com.fr.workspace.WorkContext; |
|
|
|
import com.fr.workspace.Workspace; |
|
|
|
import com.fr.workspace.Workspace; |
|
|
@ -81,7 +81,7 @@ public class DesignerLatencyMetric { |
|
|
|
this.scheduler = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("LatencyMetricWorker")); |
|
|
|
this.scheduler = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("LatencyMetricWorker")); |
|
|
|
this.scheduler.scheduleWithFixedDelay(this::collectAndSubmit, 60, 60, TimeUnit.MINUTES); |
|
|
|
this.scheduler.scheduleWithFixedDelay(this::collectAndSubmit, 60, 60, TimeUnit.MINUTES); |
|
|
|
// 注册设计器工作目录切换事件监听
|
|
|
|
// 注册设计器工作目录切换事件监听
|
|
|
|
EventDispatcher.listen(WorkspaceEvent.AfterSwitch, new Listener<Workspace>() { |
|
|
|
EventDispatcher.listen(WorkspaceEvent.BeforeSwitch, new Listener<Workspace>() { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void on(Event event, Workspace param) { |
|
|
|
public void on(Event event, Workspace param) { |
|
|
|
collectAndSubmit(); |
|
|
|
collectAndSubmit(); |
|
|
@ -162,14 +162,12 @@ public class DesignerLatencyMetric { |
|
|
|
info.put(APPID, MarketConfig.getInstance().getCloudOperationMaintenanceId()); |
|
|
|
info.put(APPID, MarketConfig.getInstance().getCloudOperationMaintenanceId()); |
|
|
|
info.put(USERID, MarketConfig.getInstance().getBbsUid()); |
|
|
|
info.put(USERID, MarketConfig.getInstance().getBbsUid()); |
|
|
|
info.put(DESIGNER_ID, DesignerEnvManager.getEnvManager().getUUID()); |
|
|
|
info.put(DESIGNER_ID, DesignerEnvManager.getEnvManager().getUUID()); |
|
|
|
info.put(DESIGNER_VERSION, ProductConstants.DESIGNER_VERSION); |
|
|
|
info.put(DESIGNER_VERSION, GeneralUtils.getVersion()); |
|
|
|
info.put(DESIGN_METHOD, WorkContext.getCurrent().isLocal() ? LOCAL : REMOTE); |
|
|
|
info.put(DESIGN_METHOD, WorkContext.getCurrent().isLocal() ? LOCAL : REMOTE); |
|
|
|
info.put(OPERANDS_NUM, LATENCY_CONTAINER.values().stream().mapToInt(AtomicInteger::get).sum()); |
|
|
|
info.put(OPERANDS_NUM, LATENCY_CONTAINER.values().stream().mapToInt(AtomicInteger::get).sum()); |
|
|
|
for (Map.Entry<LatencyLevel, AtomicInteger> entry : LATENCY_CONTAINER.entrySet()) { |
|
|
|
for (Map.Entry<LatencyLevel, AtomicInteger> entry : LATENCY_CONTAINER.entrySet()) { |
|
|
|
if (!LatencyLevel.UNDEFINE.equals(entry.getKey())) { |
|
|
|
|
|
|
|
info.put(entry.getKey().getMark(), entry.getValue().get()); |
|
|
|
info.put(entry.getKey().getMark(), entry.getValue().get()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return info; |
|
|
|
return info; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|