Skip to content

Commit

Permalink
Update MxController.java
Browse files Browse the repository at this point in the history
  • Loading branch information
RockyLOMO committed Nov 23, 2024
1 parent ec1067f commit b17b381
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions rxlib/src/main/java/org/rx/spring/MxController.java
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,18 @@ public Object health(HttpServletRequest request) {
}

@RequestMapping("health/p")
public void healthP(HttpServletRequest request, HttpServletResponse response) {
public Object healthP(HttpServletRequest request, HttpServletResponse response) {
if ("1".equals(request.getParameter("mock"))) {
return 1;
}
String fu = request.getParameter("fu");
Integer tm = Reflects.convertQuietly(request.getParameter("tm"), Integer.class);
HttpClient client = new HttpClient();
if (tm != null) {
client.withTimeoutMillis(tm);
}
client.forward(request, response, fu);
return null;
}

// @SneakyThrows
Expand Down Expand Up @@ -206,9 +210,7 @@ Map<String, Object> findTopUsage(Date begin, Date end) {
return result;
}

Map<String, Object> queryTraces(Date startTime, Date endTime, String level, String keyword, Boolean newest,
Boolean methodOccurMost, String methodNamePrefix, String metricsName,
Integer take) {
Map<String, Object> queryTraces(Date startTime, Date endTime, String level, String keyword, Boolean newest, Boolean methodOccurMost, String methodNamePrefix, String metricsName, Integer take) {
Map<String, Object> result = new LinkedHashMap<>(3);
ExceptionLevel el = null;
if (!Strings.isBlank(level)) {
Expand Down Expand Up @@ -281,9 +283,7 @@ Map<String, Object> svrState(HttpServletRequest request) {

j.put("rxConfig", RxConfig.INSTANCE);
j.put("requestHeaders", Linq.from(Collections.list(request.getHeaderNames())).select(p -> String.format("%s: %s", p, String.join("; ", Collections.list(request.getHeaders(p))))));
j.putAll(queryTraces(null, null, null, null, null,
null, null, null,
take));
j.putAll(queryTraces(null, null, null, null, null, null, null, null, take));
return j;
}

Expand Down

0 comments on commit b17b381

Please sign in to comment.