Skip to content

Commit

Permalink
add 2xx
Browse files Browse the repository at this point in the history
  • Loading branch information
alberto-zhang committed Feb 21, 2020
1 parent ed554d9 commit 7edeef9
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ public void doFilter(ServletRequest request, ServletResponse response, FilterCha
obj.put(FAIL5XX_REQUST, (int) obj.get(FAIL_REQUST)-(int) obj.get(FAIL4XX_REQUST));
throw e;
}
obj.put(OK_REQUST, (int) obj.get(TOTAL_REQUST) - (int) obj.get(FAIL_REQUST));
okCount=totalCount-failCount;
// update map
EndpointCount.put(endpoint, obj);
} else {
Expand Down
19 changes: 19 additions & 0 deletions src/main/java/org/tron/trongeventquery/monitor/MonitorInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ public NetInfo setLatency(LatencyInfo latency) {
public static class ApiInfo {
private int totalCount;
private int totalFailCount;
private int totalCount2xx;
private int totalCount4xx;
private int totalCount5xx;

Expand All @@ -320,6 +321,15 @@ public ApiInfo setTotalFailCount(int totalFailCount) {
return this;
}

public int getTotalCount2xx() {
return this.totalCount2xx;
}

public ApiInfo setTotalCount2xx(int totalCount2xx) {
this.totalCount2xx = totalCount2xx;
return this;
}

public int getTotalCount4xx() {
return this.totalCount4xx;
}
Expand Down Expand Up @@ -353,6 +363,7 @@ public static class ApiDetailInfo {
private int failCount;
private int count4xx;
private int count5xx;
private int count2xx;


public String getName() {
Expand Down Expand Up @@ -399,6 +410,14 @@ public ApiDetailInfo setCount5xx(int count5xx) {
this.count5xx = count5xx;
return this;
}
public int getCount2xx() {
return this.count2xx;
}

public ApiDetailInfo setCount2xx(int count2xx) {
this.count2xx = count2xx;
return this;
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public void setNetInfo(MonitorInfo.DataInfo data) {
MonitorInfo.DataInfo.NetInfo.ApiInfo apiInfo = new MonitorInfo.DataInfo.NetInfo.ApiInfo();
CommonFilter commonFilter=new CommonFilter();
apiInfo.setTotalCount(commonFilter.getInstance().getTotalCount());
apiInfo.setTotalCount2xx(commonFilter.getInstance().getOkCount());
apiInfo.setTotalFailCount(commonFilter.getInstance().getFailCount());
apiInfo.setTotalCount4xx(commonFilter.getInstance().getCount4xx());
apiInfo.setTotalCount5xx(commonFilter.getInstance().getCount5xx());
Expand All @@ -47,6 +48,7 @@ public void setNetInfo(MonitorInfo.DataInfo data) {
apiDetail.setName(entry.getKey());
apiDetail.setCount((int)entry.getValue().get(CommonFilter.TOTAL_REQUST));
apiDetail.setFailCount((int)entry.getValue().get(CommonFilter.FAIL_REQUST));
apiDetail.setCount2xx((int)entry.getValue().get(CommonFilter.OK_REQUST));
apiDetail.setCount4xx((int)entry.getValue().get(CommonFilter.FAIL4XX_REQUST));
apiDetail.setCount5xx((int)entry.getValue().get(CommonFilter.FAIL5XX_REQUST));
apiDetails.add(apiDetail);
Expand Down

0 comments on commit 7edeef9

Please sign in to comment.