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 W3C trace context from build PipelineRuns to Snapshots,
integration PipelineRuns, and Release CRs. Emit waitDuration and
executeDuration timing spans on completed PipelineRuns across both
ComponentGroup and Application model flows.
Tracing is opt-in via OTEL_EXPORTER_OTLP_ENDPOINT; without it set, the
service uses a noop tracer. The sampler family is selected via
OTEL_TRACES_SAMPLER.
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, and release lifecycle.
|`OTEL_TRACES_SAMPLER_ARG`| Ratio for ratio-based samplers (e.g. `0.1`). |*(unused unless a ratio sampler is selected)*|
12
+
|`TRACING_LABEL_ACTION`| PipelineRun label read to populate `cicd.pipeline.action.name`. Empty string disables the attribute. |`delivery.tekton.dev/action`|
13
+
|`TRACING_LABEL_APPLICATION`| PipelineRun label read to populate `delivery.tekton.dev.application`. Empty string disables the attribute. |`delivery.tekton.dev/application`|
14
+
|`TRACING_LABEL_COMPONENT`| PipelineRun label read to populate `delivery.tekton.dev.component`. Empty string disables the attribute. |`delivery.tekton.dev/component`|
15
+
16
+
## Emitted spans
17
+
18
+
Two spans are emitted per PipelineRun when it completes:
19
+
20
+
-`waitDuration`: `pr.CreationTimestamp` to `pr.Status.StartTime`
21
+
-`executeDuration`: `pr.Status.StartTime` to `pr.Status.CompletionTime`
22
+
23
+
The build-pipeline and integration-pipeline controllers each emit for their respective PipelineRun types. The `delivery.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 | PipelineRun's `Succeeded` condition message on failure. Omitted on success; truncated to 1024 bytes (UTF-8 safe). |
50
+
51
+
## Superseded Snapshot dedup
52
+
53
+
When the snapshot controller skips auto-release because a newer Snapshot for the same Application has already been released, a single `waitDuration` span is emitted on the superseded Snapshot's trace context, anchored at the Snapshot's `CreationTimestamp` and ending at the `AutoReleased` condition's `LastTransitionTime`. It carries `cicd.pipeline.result=skip` and `delivery.tekton.dev.result_message="Released in newer Snapshot"` so the trace distinguishes the deliberate dedup from a broken chain.
@@ -1466,3 +1474,18 @@ func (a *Adapter) IsLatestBuildPipelineRunInComponentWithPRGroupHash(buildPlr *t
1466
1474
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))
1467
1475
returnfalse, nil
1468
1476
}
1477
+
1478
+
// emitBuildTimingSpans emits timing spans for the build PipelineRun if not already emitted
0 commit comments