feat(tracing): add spans for When Expression evaluation
#9,782 opened on Apr 16, 2026
Repository metrics
- Stars
- (9,013 stars)
- PR merge metrics
- (PR metrics pending)
Description
Feature request
Add OpenTelemetry spans to the When Expression evaluation path. CEL compilation/evaluation and Input/Operator/Values matching are currently invisible in traces, making it impossible to debug why tasks were skipped.
Use case
When a PipelineRun skips tasks due to When Expressions, the trace shows the parent reconcile span but gives no visibility into which expression evaluated to false or how long CEL compilation took.
Implementation hints
Key functions to instrument:
pkg/reconciler/pipelinerun/pipelinerun.go:746—EvaluateCEL()call for DAG tasks (inside loop)pkg/reconciler/pipelinerun/pipelinerun.go:965—EvaluateCEL()call for finally taskspkg/reconciler/pipelinerun/resources/pipelinerunresolution.go:104—EvaluateCEL()function itself — CEL env creation, compilation, evaluationpkg/reconciler/pipelinerun/resources/pipelinerunresolution.go:488—skipBecauseWhenExpressionsEvaluatedToFalse()pkg/apis/pipeline/v1/when_types.go:129—AllowsExecution()
Span attributes to add: expression text, result (true/false), skip reason.
Parent spans exist: reconcile and runNextSchedulableTask are already spanned.
Part of umbrella: #9701
good first issue — focused scope, 2-3 functions, clear parent spans.