feat(tracing): add spans to timeout and cancellation code paths
#9,783 创建于 2026年4月16日
仓库指标
- 星标
- (9,013 个星标)
- PR 合并指标
- (PR 指标待抓取)
描述
Feature request
Add OpenTelemetry spans to the PipelineRun cancellation and timeout helpers. These code paths have zero tracing, making it impossible to trace why a run was stopped or how long child-patching took.
Use case
When a PipelineRun times out, the trace ends abruptly. Adding spans to the cancel/timeout functions reveals: which children were patched, how long each patch took, and whether graceful cancellation triggered finally tasks.
Implementation hints
PipelineRun — pkg/reconciler/pipelinerun/cancel.go:
cancelPipelineRun— marks PR cancelled, patches all childrengracefullyCancelPipelineRun— cancels tasks but triggers finallycancelPipelineTaskRunsForTaskNames— iterates children, patches eachcancelTaskRun/cancelCustomRun— individual child patches
PipelineRun — pkg/reconciler/pipelinerun/timeout.go:
timeoutPipelineRun— marks PR timed out, patches all childrentimeoutPipelineTasksForTaskNames— iterates children, patches eachtimeoutTaskRun/timeoutCustomRun— individual child patches
TaskRun — pkg/reconciler/taskrun/taskrun.go:
- Line 185:
IsCancelled()branch — add span attributereason=Cancelled - Line 199:
HasTimedOut()branch — add span attributereason=TimedOut
Part of umbrella: #9701
good first issue — well-scoped files (cancel.go + timeout.go), clear functions.