Today we associate child tasks with their parents by explicitly calling TaskAwareRequest#setParentTask in almost 100 places. This is easy to forget or to get wrong (e.g. #88616) and yet we increasingly rely on these parent/child associations for things like support cases and our APM integration.
We should make it so that the path of least friction is one that automatically links tasks with their parents, so that opting-out of this behaviour needs additional effort. For instance, almost all calls to TransportService#sendRequest should be using sendChildRequest instead, and NodeClient should be able to set up parent task relationships too. Maybe this means we need a different Client for the REST layer, or maybe we could create tasks for REST requests too.
Today we associate child tasks with their parents by explicitly calling
TaskAwareRequest#setParentTaskin almost 100 places. This is easy to forget or to get wrong (e.g. #88616) and yet we increasingly rely on these parent/child associations for things like support cases and our APM integration.We should make it so that the path of least friction is one that automatically links tasks with their parents, so that opting-out of this behaviour needs additional effort. For instance, almost all calls to
TransportService#sendRequestshould be usingsendChildRequestinstead, andNodeClientshould be able to set up parent task relationships too. Maybe this means we need a differentClientfor the REST layer, or maybe we could create tasks for REST requests too.