Description
Tasks and their parents
To build the tree of tasks, we need to know that a task has been spawned in the context of another task. For that purpose, we can introduce a parent_id field in the Task message. This will be optional and will contain the span if of the parent of the task. We should apply the filtering necessary to ensure that this field is populated only with IDs that correspond to tasks, not other spans.
Resources and async ops
Each async op should be associated with one resource. We already have this data as each async op has a resource_id
field.
Resources and other resources
There are cases when a resource can be a child of another resource. One such example is RwLock
which uses a Semaphore
internally. It feels like we want to capture this relationship. That being said, each resource should have an optional parent_id
field.
Tasks and resources.
We want to be able to show the interaction between resources and tasks. More precisely, we want to show that a task is waiting on a resource. Multiple tasks can wait on a single resource at a time. This association is done via async ops. Each async operation message has a task_id
field. This means that we now have all the data to show when a task is awaiting on a resource and which resource/async op that is.
Potential UI changes:
Waiting on section in Task details
The most noninvasive change we can do is to add a section in the task details view that shows us the resources this particular task is waiting on. I assume that the mechanics of doing that is looking at all pending async ops that are present and showing the resource information for both the resource as well as the async op.
Tree view
Tasks tree view
This will show a tree view of tasks and their children, we will be able to collapse/expand nodes and navigate through the tree. Each time we select a task from the tree, we can show its details in a side pain.
Resource tree view
This will show a tree of resource and their children. The leaf nodes can be either other resources or async ops that are currently live for this resource. Again selecting any of the nodes will show the details. Of course, details will be different based on whether this is an async op or a resource.