Skip to content

Commit

Permalink
add a comment for elapsed-time header intercept
Browse files Browse the repository at this point in the history
  • Loading branch information
alisman committed Dec 18, 2024
1 parent dfa4740 commit 5cce667
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/java/org/cbioportal/web/GeneralControllerAdvice.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ public boolean supports(MethodParameter returnType, Class<? extends HttpMessageC
@Override
public Object beforeBodyWrite(Object body, MethodParameter returnType, MediaType selectedContentType, Class<? extends HttpMessageConverter<?>> selectedConverterType, ServerHttpRequest request, ServerHttpResponse response) {
ServletServerHttpRequest servletServerRequest = (ServletServerHttpRequest) request;

// report the procesing time of all api endpoints to aid in benchmarking as we transition
// to clickhouse
long startTime = (long) servletServerRequest.getServletRequest().getAttribute("startTime");
long timeElapsed = System.currentTimeMillis() - startTime;
response.getHeaders().add("Elapsed-Time", String.valueOf(timeElapsed));
Expand Down

0 comments on commit 5cce667

Please sign in to comment.