Skip to content

Commit 23ea894

Browse files
dnhatnsmalyshev
authored andcommitted
Span new trace context for compute group task (elastic#125151)
We need to create a new trace context when registering a task. There are other issues with the task group, but I need this change to enable allow_partial_results first, then follow up with other enhancements.
1 parent 6ac7d7a commit 23ea894

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/plugin/ComputeService.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -435,11 +435,13 @@ Runnable cancelQueryOnFailure(CancellableTask task) {
435435

436436
CancellableTask createGroupTask(Task parentTask, Supplier<String> description) throws TaskCancelledException {
437437
final TaskManager taskManager = transportService.getTaskManager();
438-
return (CancellableTask) taskManager.register(
439-
"transport",
440-
"esql_compute_group",
441-
new ComputeGroupTaskRequest(parentTask.taskInfo(transportService.getLocalNode().getId(), false).taskId(), description)
442-
);
438+
try (var ignored = transportService.getThreadPool().getThreadContext().newTraceContext()) {
439+
return (CancellableTask) taskManager.register(
440+
"transport",
441+
"esql_compute_group",
442+
new ComputeGroupTaskRequest(parentTask.taskInfo(transportService.getLocalNode().getId(), false).taskId(), description)
443+
);
444+
}
443445
}
444446

445447
private static class ComputeGroupTaskRequest extends TransportRequest {

0 commit comments

Comments
 (0)