You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add distributed tracing with timing spans and trace propagation
Propagate trace context from build PipelineRuns to Snapshots,
integration PipelineRuns, and Release CRs. Emit waitDuration and
executeDuration timing spans for build and integration PipelineRuns.
Create a new root span when valid trace context is missing. See
docs/tracing.md.
Assisted-by: Claude Code
Signed-off-by: Josiah England <jengland@redhat.com>
Mermaid is a JS based diagramming tool that renders markdown style syntax to create/modify diagrams. Mermaid has [native support in Github](https://github.com/github/roadmap/issues/372)
The operator emits OpenTelemetry spans for build and integration-test PipelineRuns it reconciles, and propagates the trace context forward onto Snapshots and downstream Release CRs so a single trace can span the build → test → release lifecycle.
The build-pipeline and integration-pipeline controllers each emit for their respective PipelineRun types. The `tekton.dev/timingEmitted` annotation guards against re-emission on subsequent reconciles.
24
+
25
+
## Trace-context propagation
26
+
27
+
Parenting follows the W3C Trace Context in the `tekton.dev/pipelinerunSpanContext` annotation. The annotation is propagated across resource boundaries so a single trace covers the full delivery flow:
28
+
29
+
```
30
+
build PipelineRun (annotation set by upstream)
31
+
└── Snapshot (annotation copied from the build PipelineRun)
32
+
├── integration-test PipelineRun (annotation copied from the Snapshot)
33
+
└── Release CR (annotation copied from the Snapshot)
34
+
```
35
+
36
+
When the annotation is absent, spans are still emitted but without a parent.
37
+
38
+
## Span attributes
39
+
40
+
| Attribute | Span | Source |
41
+
|---|---|---|
42
+
|`namespace`| both |`pr.GetNamespace()`|
43
+
|`pipelinerun`| both |`pr.GetName()`|
44
+
|`delivery.tekton.dev.pipelinerun_uid`| both |`pr.GetUID()`|
45
+
|`cicd.pipeline.action.name`| both | PipelineRun label (name configurable via `TRACING_LABEL_ACTION`) |
46
+
|`delivery.tekton.dev.application`| both | PipelineRun label (name configurable via `TRACING_LABEL_APPLICATION`) |
47
+
|`delivery.tekton.dev.component`| both | PipelineRun label (name configurable via `TRACING_LABEL_COMPONENT`) |
48
+
|`cicd.pipeline.result`| execute |`Succeeded` condition mapped to the semconv `cicd.pipeline.result` enum (`success` / `failure` / `timeout` / `cancellation` / `error`) |
49
+
|`delivery.tekton.dev.result_message`| execute | Earliest failing TaskRun's `Succeeded` condition message, falling back to the PipelineRun's own condition message. Omitted on success; truncated to 1024 bytes (UTF-8 safe). |
@@ -1359,3 +1368,30 @@ func (a *Adapter) IsLatestBuildPipelineRunInComponentWithPRGroupHash(buildPlr *t
1359
1368
a.logger.Info(fmt.Sprintf("The build pipelineRun %s/%s with pr group %s is not the latest for its component, skipped", buildPlr.Namespace, buildPlr.Name, prGroupName))
1360
1369
returnfalse, nil
1361
1370
}
1371
+
1372
+
// emitBuildTimingSpans emits timing spans for the build PipelineRun if not already emitted
1373
+
func (a*Adapter) emitBuildTimingSpans() {
1374
+
// Check if timing spans have already been emitted
1375
+
if_, found:=a.pipelineRun.Annotations[tektonconsts.TimingEmittedAnnotation]; found {
0 commit comments