[NO ISSUE][FUN] Return elapsedTime in Seconds
- user model changes: no
- storage format changes: no
- interface changes: no
Details:
- Return elapsedTime as a double in seconds in
active/completed_requests functions' response
rather than a string in milliseconds.
Change-Id: I412101ea43c1cbe13b15ed3ebb246af3c52e7b17
Reviewed-on: https://asterix-gerrit.ics.uci.edu/3348
Contrib: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>
Sonar-Qube: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
diff --git a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/BaseClientRequest.java b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/BaseClientRequest.java
index 51971a5..eaca53b 100644
--- a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/BaseClientRequest.java
+++ b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/BaseClientRequest.java
@@ -97,7 +97,7 @@
ObjectNode json = JSONUtil.createObject();
json.put("uuid", requestReference.getUuid());
json.put("requestTime", new ADateTime(requestReference.getTime()).toSimpleString());
- json.put("elapsedTime", getElapsedTime());
+ json.put("elapsedTime", getElapsedTimeInSecs());
json.put("node", requestReference.getNode());
json.put("state", state.getLabel());
json.put("userAgent", ((RequestReference) requestReference).getUserAgent());
@@ -106,11 +106,10 @@
return json;
}
- private String getElapsedTime() {
+ private double getElapsedTimeInSecs() {
// this is just an estimation as the request might have been received on a node with a different system time
- // TODO add dynamic time unit
long runningTime = completionTime > 0 ? completionTime : System.currentTimeMillis();
- return runningTime - requestReference.getTime() + "ms";
+ return (runningTime - requestReference.getTime()) / 1000d;
}
protected abstract void doCancel(ICcApplicationContext appCtx) throws HyracksDataException;