Authored by jack.xue

fix type bug

... ... @@ -44,17 +44,20 @@ public class NginxService {
BaseResponse response = new BaseResponse();
List<NginxView> nginxViewList = new ArrayList<>();
if (StringUtils.equals(InterVar.AWS_TYPE, request.getType())) {
for (Map.Entry<Integer, MObjectInfo> oneMObject : InterVar.moMaps.entrySet()) {
if (StringUtils.equals(InterVar.AWS_TYPE, request.getType()) && oneMObject.getValue().getMoHostIp().startsWith(InterVar.AWS_PREFIX)) {
if (oneMObject.getValue().getMoHostIp().startsWith(InterVar.AWS_PREFIX)) {
nginxViewList.add(buildNginxView(oneMObject.getValue()));
} else if (StringUtils.equals(InterVar.QC_TYPE, request.getType()) && oneMObject.getValue().getMoHostIp().startsWith(InterVar.QC_PREFIX)) {
}
}
} else if (StringUtils.equals(InterVar.QC_TYPE, request.getType())) {
for (Map.Entry<Integer, MObjectInfo> oneMObject : InterVar.moMaps.entrySet()) {
if (oneMObject.getValue().getMoHostIp().startsWith(InterVar.QC_PREFIX)) {
nginxViewList.add(buildNginxView(oneMObject.getValue()));
}
}
} else {
for (Map.Entry<Integer, MObjectInfo> oneMObject : InterVar.moMaps.entrySet()) {
nginxViewList.add(buildNginxView(oneMObject.getValue()));
}
}
... ... @@ -327,7 +330,6 @@ public class NginxService {
}
@RequestMapping(value = "/errTab")
public BaseResponse queryErrTab(@RequestBody NginxTypeRequest request) {
BaseResponse response = new BaseResponse();
... ... @@ -372,5 +374,4 @@ public class NginxService {
}
}
... ...
... ... @@ -17,7 +17,7 @@ public class ApiJob extends BaseLogJob {
public ApiJob(InfluxComp influxComp, String type) {
super(influxComp, InterVar.APIACCESSMEASURE);
super(influxComp, InterVar.APIACCESSMEASURE, type);
this.type = type;
}
... ...
... ... @@ -5,10 +5,12 @@ import com.monitor.middleware.nginx.constant.InterVar;
import com.monitor.middleware.nginx.model.ApiSeriesModel;
import com.monitor.middleware.nginx.model.ApiStaModel;
import com.monitor.middleware.rabbitmq.component.InfluxComp;
import org.apache.commons.lang.StringUtils;
import org.aspectj.lang.annotation.After;
import org.influxdb.dto.BatchPoints;
import org.influxdb.dto.Point;
import org.influxdb.dto.QueryResult;
import org.jboss.netty.util.internal.StringUtil;
import java.text.DecimalFormat;
import java.util.*;
... ... @@ -30,15 +32,19 @@ public class BaseLogJob implements Callable {
protected List<ApiSeriesModel> apiSeriesModelList = new ArrayList<>();
private String type;
DecimalFormat format = new DecimalFormat("0.00");
protected String measureName;
public BaseLogJob(InfluxComp influxComp, String measureName) {
public BaseLogJob(InfluxComp influxComp, String measureName, String type) {
this.influxComp = influxComp;
this.measureName = measureName;
this.type = type;
}
public void doTask() {
... ... @@ -208,6 +214,9 @@ public class BaseLogJob implements Callable {
for (List<Object> oneRow : oneSeries.getValues()) {
if (!StringUtils.equals(type, queryLocation(oneRow.get(KINDEXMAPS.get("log_ip")).toString()))) {
continue;
}
ApiSeriesModel apiSeriesModel = new ApiSeriesModel();
apiSeriesModel.setLogIp(oneRow.get(KINDEXMAPS.get("log_ip")).toString());
... ... @@ -219,6 +228,7 @@ public class BaseLogJob implements Callable {
apiSeriesModel.setStatus(oneRow.get(KINDEXMAPS.get("request_status")).toString());
apiSeriesModelList.add(apiSeriesModel);
}
}
}
... ... @@ -326,6 +336,15 @@ public class BaseLogJob implements Callable {
}
}
private String queryLocation(String ip) {
if (ip.startsWith(InterVar.AWS_PREFIX)) {
return InterVar.AWS_TYPE;
} else {
return InterVar.QC_TYPE;
}
}
@Override
public Object call() throws Exception {
doTask();
... ...
... ... @@ -206,6 +206,10 @@ public class ErrorLogJob implements Callable {
for (List<Object> oneRow : oneSeries.getValues()) {
if(!StringUtils.equals(type,queryLocation(oneRow.get(KINDEMAPS.get("log_ip")).toString())))
{
continue;
}
ErrorSeriesModel errorSeriesModel = new ErrorSeriesModel();
errorSeriesModel.setLogIp(oneRow.get(KINDEMAPS.get("log_ip")).toString());
... ... @@ -214,7 +218,7 @@ public class ErrorLogJob implements Callable {
if (errorSeriesModel.getMessage().contains("Lua")) {
errorSeriesModel.setType("LUA");
errorSeriesModel.setType("Lua");
} else if (errorSeriesModel.getMessage().contains(": Connection")) {
... ... @@ -229,8 +233,12 @@ public class ErrorLogJob implements Callable {
}
public void callPercent() {
private String queryLocation(String ip) {
if (ip.startsWith(InterVar.AWS_PREFIX)) {
return InterVar.AWS_TYPE;
} else {
return InterVar.QC_TYPE;
}
}
}
... ...
... ... @@ -15,7 +15,7 @@ public class ServiceJob extends BaseLogJob {
private String type;
public ServiceJob(InfluxComp influxComp, String type) {
super(influxComp, InterVar.SERACCESSMEASURE);
super(influxComp, InterVar.SERACCESSMEASURE, type);
this.type = type;
}
... ...