Skip to content

Commit 993b01d

Browse files
EQL: correct time accounting for an intermediary response (#75804) (#76000)
This corrects the accounting of answer time reported in "took" attribute of an intermediary EQL async response. This has been reported as a negative value, since the delta mixes wall-clock time with VM time. (The confusion is favoured by Task#getStartTime() returning a wall-clock time, while Task#getStartTimeNanos() VM's time.) Co-authored-by: Bogdan Pintea <[email protected]>
1 parent 71358c7 commit 993b01d

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

x-pack/plugin/eql/qa/rest/src/yamlRestTest/resources/rest-api-spec/test/eql/10_basic.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ setup:
309309

310310
- is_true: id
311311
- set: {id: id}
312+
- gte: {took: 0}
312313

313314
- do:
314315
eql.get:

x-pack/plugin/eql/src/main/java/org/elasticsearch/xpack/eql/plugin/TransportEqlSearchAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public void execute(EqlSearchRequest request, EqlSearchTask task, ActionListener
9393
@Override
9494
public EqlSearchResponse initialResponse(EqlSearchTask task) {
9595
return new EqlSearchResponse(EqlSearchResponse.Hits.EMPTY,
96-
threadPool.relativeTimeInMillis() - task.getStartTime(), false, task.getExecutionId().getEncoded(), true, true);
96+
TimeValue.nsecToMSec(System.nanoTime() - task.getStartTimeNanos()), false, task.getExecutionId().getEncoded(), true, true);
9797
}
9898

9999
@Override

0 commit comments

Comments
 (0)