Skip to content

Commit

Permalink
[ML] Start a new trace context before loading a trained model (elasti…
Browse files Browse the repository at this point in the history
…c#103124)

Each distinct task is a different span in APM tracing, so needs
a new trace context.
  • Loading branch information
droberts195 authored Dec 7, 2023
1 parent c6eff19 commit d8bbc62
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions docs/changelog/103124.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pr: 103124
summary: Start a new trace context before loading a trained model
area: Machine Learning
type: bug
issues: []
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,14 @@ public void clusterChanged(ClusterChangedEvent event) {
}

if (shouldLoadModel(routingInfo, trainedModelAssignment.getDeploymentId(), isResetMode)) {
prepareModelToLoad(
createStartTrainedModelDeploymentTaskParams(trainedModelAssignment, routingInfo.getCurrentAllocations())
StartTrainedModelDeploymentAction.TaskParams params = createStartTrainedModelDeploymentTaskParams(
trainedModelAssignment,
routingInfo.getCurrentAllocations()
);
// Loading the model is done by a separate task, so needs a new trace context
try (var ignored = threadPool.getThreadContext().newTraceContext()) {
prepareModelToLoad(params);
}
}
}

Expand Down

0 comments on commit d8bbc62

Please sign in to comment.