Skip to content

Commit

Permalink
Add query execution time in HTTP response
Browse files Browse the repository at this point in the history
Resolves: #8579
  • Loading branch information
luigidellaquila committed Oct 5, 2018
1 parent c81919a commit 7c2b68b
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public boolean execute(final OHttpRequest iRequest, OHttpResponse iResponse) thr
Object params = null;
String mode = "resultset";

long begin = System.currentTimeMillis();
if (iRequest.content != null && !iRequest.content.isEmpty()) {
// CONTENT REPLACES TEXT
if (iRequest.content.startsWith("{")) {
Expand Down Expand Up @@ -102,6 +103,7 @@ public boolean execute(final OHttpRequest iRequest, OHttpResponse iResponse) thr
result.getExecutionPlan().ifPresent(x -> additionalContent.put("executionPlan", x.toResult().toElement()));

result.close();
long elapsedMs = System.currentTimeMillis() - begin;

String format = null;
if (fetchPlan != null) {
Expand All @@ -111,6 +113,7 @@ public boolean execute(final OHttpRequest iRequest, OHttpResponse iResponse) thr
if (iRequest.getHeader("TE") != null)
iResponse.setStreaming(true);

additionalContent.put("elapsedMs", elapsedMs);
iResponse.writeResult(response, format, accept, additionalContent, mode);

} finally {
Expand Down

0 comments on commit 7c2b68b

Please sign in to comment.