Skip to content

Commit

Permalink
feat(api): support recording slow query log
Browse files Browse the repository at this point in the history
  • Loading branch information
SunnyBoy-WYH committed Oct 16, 2023
1 parent 4bfd688 commit e1e5777
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void filter(ContainerRequestContext requestContext, ContainerResponseCont
// record slow query log
if (enableSlowQueryLog && isSlowQueryLogWhiteAPI(requestContext) &&
timeThreshold < responseTime) {
SlowQueryLog log = new SlowQueryLog(responseTime,
SlowQueryLog log = new SlowQueryLog(responseTime, (Long) requestTime,
(String) requestContext.getProperty(REQUEST_PARAMS_JSON), method, timeThreshold, path);
LOG.info("slow query log: {}", JsonUtil.toJson(log));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public class SlowQueryLog {

public Long executeTime;

public Long startTime;

public String rawQuery;

public String method;
Expand All @@ -29,7 +31,9 @@ public class SlowQueryLog {

public String path;

public SlowQueryLog(Long executeTime, String rawQuery, String method, Long threshold,


public SlowQueryLog(Long executeTime, Long startTime, String rawQuery, String method, Long threshold,
String path) {
this.executeTime = executeTime;
this.rawQuery = rawQuery;
Expand Down

0 comments on commit e1e5777

Please sign in to comment.