tektoncd/pipeline

feat(tracing): add semantic span attributes to reconciler child spans

開放

#9,785 建立於 2026年4月16日

 (1 則留言) (0 個反應) (1 位負責人)Go (1,943 個分叉)auto 404
good first issuekind/feature

倉庫指標

星標
 (9,013 顆星)
PR 合併指標
 (平均合併 9天 3小時) (30 天內合併 137 個 PR)

描述

Feature request

22 of 26 child spans in the PipelineRun/TaskRun reconcilers carry zero attributes — they are unqueryable timers. Add semantic attributes (outcome, error reason, task/pipeline ref, step count) to key spans.

Use case

Operators cannot filter or search traces by outcome ("show me all failed createPod spans") because spans lack queryable attributes. Adding semantic attributes enables Jaeger/Tempo filtering and alerting on specific span patterns.

Implementation hints

Spans missing attributes (all have zero today):

In pkg/reconciler/pipelinerun/pipelinerun.go:

  • reconcile, resolvePipelineState, runNextSchedulableTask, createTaskRuns — add pipeline name, task count, status

In pkg/reconciler/taskrun/taskrun.go:

  • reconcile, createPod, stopSidecars, failTaskRun — add task name, step count, failure reason

Also fix:

  • Deduplicate identical SetAttributes calls between initTracing root spans and ReconcileKind spans (attributes set twice per reconcile)
  • Use OTel semantic conventions (k8s.namespace.name) instead of ad-hoc keys ("namespace") to align with semconv v1.40.0 bump in #9697

Pattern:

span.SetAttributes(
    attribute.String("tekton.pipeline.name", pipelineName),
    attribute.Int("tekton.task.count", len(tasks)),
    attribute.String("tekton.status", string(condition.Reason)),
)

Part of umbrella: #9701

good first issue — no new spans needed, just add attributes to existing ones.

貢獻者指南