|
@ -1,11 +1,13 @@
|
|
|
package com.yihu.hos.monitor.service;
|
|
|
|
|
|
import com.mongodb.*;
|
|
|
import com.yihu.hos.common.constants.ContextAttributes;
|
|
|
import com.yihu.hos.core.datatype.CollectionUtil;
|
|
|
import com.yihu.hos.monitor.dao.ServiceMonitorDao;
|
|
|
import com.yihu.hos.system.model.SystemServiceEndpoint;
|
|
|
import com.yihu.hos.system.model.SystemServiceFlow;
|
|
|
import com.yihu.hos.system.model.SystemServiceFlowConfig;
|
|
|
import com.yihu.hos.tenant.model.TenantSession;
|
|
|
import com.yihu.hos.web.framework.constant.ServiceFlowConstant;
|
|
|
import com.yihu.hos.web.framework.model.Result;
|
|
|
import com.yihu.hos.web.framework.model.TreeView;
|
|
@ -16,6 +18,7 @@ import org.springframework.data.mongodb.core.MongoOperations;
|
|
|
import org.springframework.data.mongodb.core.MongoTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.servlet.http.HttpSession;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
@ -39,10 +42,11 @@ public class ServiceMonitorService {
|
|
|
@Autowired
|
|
|
private ServiceMonitorDao serviceMonitorDao;
|
|
|
|
|
|
public Result metrics(String id, String beginTime, String endTime) throws Exception {
|
|
|
public Result metrics(HttpSession session,String id, String beginTime, String endTime) throws Exception {
|
|
|
String name;
|
|
|
String code;
|
|
|
String description;
|
|
|
TenantSession tenantSession = (TenantSession)session.getAttribute(ContextAttributes.TENANT_SESSION);
|
|
|
if (id.contains("flow")) {
|
|
|
Integer flowId = Integer.parseInt(id.replace("flow", ""));
|
|
|
SystemServiceFlow systemServiceFlow = serviceMonitorDao.getFlowById(flowId);
|
|
@ -68,7 +72,8 @@ public class ServiceMonitorService {
|
|
|
new BasicDBObject().append(QueryOperators.GTE, beginTime)),
|
|
|
new BasicDBObject().append("createTime",
|
|
|
new BasicDBObject().append(QueryOperators.LT, endTime)),
|
|
|
new BasicDBObject("name", code)});
|
|
|
new BasicDBObject("name", code),
|
|
|
new BasicDBObject("tenant", tenantSession.getTenant())});
|
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
DBCursor cursor = metrics.find(queryObject);
|