Skip to content

Commit 87e7b08

Browse files
authored
Improve "make root node" trace attributes (#92941)
### What? Improve the trace span attributes for "make root node" operations in the turbo-tasks backend. Instead of recording only the raw `task_id`, the spans now include a human-readable task description (type name + task ID) via `debug_get_task_description`. ### Why? When profiling or debugging with tracing tools, raw task IDs are opaque and require additional lookups to understand which task is being processed. Including a human-readable task description (e.g. `TaskId(42) MyFunction(args...)`) makes traces immediately actionable. Two spans were affected: - `"make root node for strongly consistent read"` in `backend/mod.rs` - `"make root node for removing collectible"` in `backend/operation/update_collectible.rs` ### How? - Added `debug_get_task_description` method to the `ExecuteContext` trait in `operation/mod.rs` - Implemented it on `ExecuteContextImpl` by delegating to the existing `backend.debug_get_task_description` method (already used in other tracing spans) - Replaced `%task_id` (which formats only the ID) with `task = self.debug_get_task_description(task_id)` / `task = ctx.debug_get_task_description(task_id)` in both span definitions <!-- NEXT_JS_LLM_PR -->
1 parent 1aeb6b1 commit 87e7b08

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

turbopack/crates/turbo-tasks-backend/src/backend/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ impl<B: BackingStorage> TurboTasksBackendInner<B> {
555555
{
556556
let _span = tracing::trace_span!(
557557
"make root node for strongly consistent read",
558-
%task_id
558+
task = self.debug_get_task_description(task_id)
559559
)
560560
.entered();
561561
AggregationUpdateQueue::run(

turbopack/crates/turbo-tasks-backend/src/backend/operation/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ pub trait ExecuteContext<'e>: Sized {
112112
this: Option<RawVc>,
113113
arg: &dyn DynTaskInputs,
114114
) -> Option<(TaskId, Arc<CachedTaskType>)>;
115+
fn debug_get_task_description(&self, task_id: TaskId) -> String;
115116
}
116117

117118
pub trait ChildExecuteContext<'e>: Send + Sized {
@@ -1007,6 +1008,10 @@ impl<'e, B: BackingStorage> ExecuteContext<'e> for ExecuteContextImpl<'e, B> {
10071008
}
10081009
None
10091010
}
1011+
1012+
fn debug_get_task_description(&self, task_id: TaskId) -> String {
1013+
self.backend.debug_get_task_description(task_id)
1014+
}
10101015
}
10111016

10121017
struct ChildExecuteContextImpl<'e, B: BackingStorage> {

turbopack/crates/turbo-tasks-backend/src/backend/operation/update_collectible.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl UpdateCollectibleOperation {
3636
{
3737
let _span = tracing::trace_span!(
3838
"make root node for removing collectible",
39-
%task_id
39+
task = ctx.debug_get_task_description(task_id)
4040
)
4141
.entered();
4242
AggregationUpdateQueue::run(

0 commit comments

Comments
 (0)