|
@ -104,13 +104,12 @@ public class ServiceMonitorService {
|
|
|
Integer count = Integer.parseInt(StringUtil.toString(dbObject.get("count")));
|
|
|
BasicDBObject id = (BasicDBObject) dbObject.get("_id");
|
|
|
String code = StringUtil.toString(id.get("routeId"));
|
|
|
if (count >= 2) {
|
|
|
if (bandwidthMapF.containsKey(code)) {
|
|
|
Integer flowCalls = bandwidthMapF.get(code);
|
|
|
bandwidthMapF.put(code, ++flowCalls);
|
|
|
} else {
|
|
|
bandwidthMapF.put(code, 1);
|
|
|
}
|
|
|
Integer bodyLength = Integer.parseInt(StringUtil.toString(dbObject.get("bodyLength")));
|
|
|
if (bandwidthMapF.containsKey(code)) {
|
|
|
bodyLength = bodyLength + bandwidthMapF.get(code);
|
|
|
bandwidthMapF.put(code, bodyLength);
|
|
|
} else {
|
|
|
bandwidthMapF.put(code, bodyLength);
|
|
|
}
|
|
|
}
|
|
|
//服务带宽
|
|
@ -120,11 +119,12 @@ public class ServiceMonitorService {
|
|
|
for (DBObject dbObject : serviceOutput.results()) {
|
|
|
BasicDBObject id = (BasicDBObject) dbObject.get("_id");
|
|
|
String code = StringUtil.toString(id.get("code"));
|
|
|
Integer bodyLength = Integer.parseInt(StringUtil.toString(dbObject.get("bodyLength")));
|
|
|
if (bandwidthMapS.containsKey(code)) {
|
|
|
Integer serviceCalls = bandwidthMapS.get(code);
|
|
|
bandwidthMapS.put(code, ++serviceCalls);
|
|
|
bodyLength = bodyLength + bandwidthMapS.get(code);
|
|
|
bandwidthMapS.put(code, bodyLength);
|
|
|
} else {
|
|
|
bandwidthMapS.put(code, 1);
|
|
|
bandwidthMapS.put(code, bodyLength);
|
|
|
}
|
|
|
|
|
|
}
|
|
@ -156,15 +156,13 @@ public class ServiceMonitorService {
|
|
|
Integer count = Integer.parseInt(StringUtil.toString(dbObject.get("count")));
|
|
|
BasicDBObject id = (BasicDBObject) dbObject.get("_id");
|
|
|
String code = StringUtil.toString(id.get("routeId"));
|
|
|
if (count >= 2) {
|
|
|
Integer total = Integer.parseInt(StringUtil.toString(dbObject.get("total")));
|
|
|
if (total == count/2) {
|
|
|
if (qpsMapF.containsKey(code)) {
|
|
|
Integer flowCalls = qpsMapF.get(code);
|
|
|
qpsMapF.put(code, ++flowCalls);
|
|
|
} else {
|
|
|
qpsMapF.put(code, 1);
|
|
|
}
|
|
|
Integer total = Integer.parseInt(StringUtil.toString(dbObject.get("total")));
|
|
|
if (total == count/2) {
|
|
|
if (qpsMapF.containsKey(code)) {
|
|
|
Integer flowCalls = qpsMapF.get(code);
|
|
|
qpsMapF.put(code, ++flowCalls);
|
|
|
} else {
|
|
|
qpsMapF.put(code, 1);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@ -298,16 +296,14 @@ public class ServiceMonitorService {
|
|
|
Integer count = Integer.parseInt(StringUtil.toString(dbObject.get("count")));
|
|
|
BasicDBObject id = (BasicDBObject) dbObject.get("_id");
|
|
|
String code = StringUtil.toString(id.get("routeId"));
|
|
|
if (count >= 2) {
|
|
|
String begin = StringUtil.toString(dbObject.get("beginTime"));
|
|
|
String end = StringUtil.toString(dbObject.get("endTime"));
|
|
|
long interval = getIntervalExact(begin, end);
|
|
|
if (delayMapF.containsKey(code)) {
|
|
|
BigDecimal flowDelay = delayMapF.get(code);
|
|
|
delayMapF.put(code, BigDecimal.valueOf(interval).add(flowDelay));
|
|
|
} else {
|
|
|
delayMapF.put(code, BigDecimal.valueOf(interval));
|
|
|
}
|
|
|
String begin = StringUtil.toString(dbObject.get("beginTime"));
|
|
|
String end = StringUtil.toString(dbObject.get("endTime"));
|
|
|
long interval = getIntervalExact(begin, end);
|
|
|
if (delayMapF.containsKey(code)) {
|
|
|
BigDecimal flowDelay = delayMapF.get(code);
|
|
|
delayMapF.put(code, BigDecimal.valueOf(interval).add(flowDelay));
|
|
|
} else {
|
|
|
delayMapF.put(code, BigDecimal.valueOf(interval));
|
|
|
}
|
|
|
}
|
|
|
|
|
@ -366,6 +362,7 @@ public class ServiceMonitorService {
|
|
|
new BasicDBObject("id", "$_id")
|
|
|
.append("code", "$code"));
|
|
|
groupFields.put("count", new BasicDBObject( "$sum", 1));
|
|
|
groupFields.put("bodyLength", new BasicDBObject( "$sum", "$bodyLength"));
|
|
|
groupFields.put("total", new BasicDBObject( "$first", "$totalServers"));
|
|
|
return new BasicDBObject("$group", groupFields);
|
|
|
}
|
|
@ -377,6 +374,7 @@ public class ServiceMonitorService {
|
|
|
new BasicDBObject("breadcrumbId", "$breadcrumbId")
|
|
|
.append("routeId", "$routeId"));
|
|
|
groupFields.put("count", new BasicDBObject( "$sum", 1));
|
|
|
groupFields.put("bodyLength", new BasicDBObject( "$sum", "$bodyLength"));
|
|
|
groupFields.put("total", new BasicDBObject( "$first", "$totalServers"));
|
|
|
groupFields.put("beginTime", new BasicDBObject( "$first", "$fireTimeSource"));
|
|
|
groupFields.put("endTime", new BasicDBObject("$last", "$fireTimeSource"));
|