Skip to content

Commit 393b9d3

Browse files
committed
docs: add tracing configuration guide and config examples
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 2b83cec commit 393b9d3

File tree

2 files changed

+57
-3
lines changed

2 files changed

+57
-3
lines changed

config/305-config-observability.yaml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ metadata:
2121
app.kubernetes.io/version: "devel"
2222
app.kubernetes.io/part-of: pipelines-as-code
2323
data:
24-
metrics-protocol: prometheus
25-
metrics-endpoint: ":9090"
2624
_example: |
2725
################################
2826
# #
@@ -50,4 +48,18 @@ data:
5048
5149
# metrics-export-interval specifies how often metrics are exported.
5250
# Only applicable for grpc and http/protobuf protocols.
53-
# metrics-export-interval: "30s"
51+
# metrics-export-interval: "30s"
52+
53+
# tracing-protocol specifies the trace export protocol.
54+
# Supported values: "grpc", "http/protobuf", "none".
55+
# Default is "none" (tracing disabled).
56+
# tracing-protocol: "none"
57+
58+
# tracing-endpoint specifies the OTLP collector endpoint.
59+
# Required when tracing-protocol is "grpc" or "http/protobuf".
60+
# The OTEL_EXPORTER_OTLP_ENDPOINT env var takes precedence if set.
61+
# tracing-endpoint: "http://otel-collector.observability.svc.cluster.local:4317"
62+
63+
# tracing-sampling-rate controls the fraction of traces sampled.
64+
# 0.0 = none, 1.0 = all. Default is 0 (none).
65+
# tracing-sampling-rate: "1.0"
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
title: Distributed Tracing
3+
weight: 5
4+
---
5+
6+
This page describes how to enable OpenTelemetry distributed tracing for Pipelines-as-Code. When enabled, PaC emits trace spans for webhook event processing and PipelineRun lifecycle timing.
7+
8+
## Enabling tracing
9+
10+
The ConfigMap `pipelines-as-code-config-observability` controls tracing configuration. See [config/305-config-observability.yaml](https://github.com/tektoncd/pipelines-as-code/blob/main/config/305-config-observability.yaml) for the full example.
11+
12+
It contains the following tracing fields:
13+
14+
* `tracing-protocol`: Export protocol. Supported values: `grpc`, `http/protobuf`, `none`. Default is `none` (tracing disabled).
15+
* `tracing-endpoint`: OTLP collector endpoint. Required when protocol is not `none`. The `OTEL_EXPORTER_OTLP_ENDPOINT` environment variable takes precedence if set.
16+
* `tracing-sampling-rate`: Fraction of traces to sample. `0.0` = none, `1.0` = all. Default is `0`.
17+
18+
### Example
19+
20+
```yaml
21+
apiVersion: v1
22+
kind: ConfigMap
23+
metadata:
24+
name: pipelines-as-code-config-observability
25+
namespace: pipelines-as-code
26+
data:
27+
tracing-protocol: grpc
28+
tracing-endpoint: "http://otel-collector.observability.svc.cluster.local:4317"
29+
tracing-sampling-rate: "1.0"
30+
```
31+
32+
Changes to the ConfigMap are picked up automatically without restarting the controller. Set `tracing-protocol` to `none` or remove the tracing keys to disable tracing.
33+
34+
## Emitted spans
35+
36+
The controller emits a `PipelinesAsCode:ProcessEvent` span covering the full lifecycle of each webhook event, from receipt through PipelineRun creation. The watcher emits `waitDuration` and `executeDuration` spans for completed PipelineRuns, using the PipelineRun's actual timestamps for accurate wall-clock timing.
37+
38+
## Trace context propagation
39+
40+
When Pipelines-as-Code creates a PipelineRun, it sets the `tekton.dev/pipelinerunSpanContext` annotation with a JSON-encoded OTel TextMapCarrier containing the W3C `traceparent`. PaC tracing works independently — you get PaC spans regardless of whether Tekton Pipelines has tracing enabled.
41+
42+
If Tekton Pipelines is also configured with tracing pointing at the same collector, its reconciler spans appear as children of the PaC span, providing a single end-to-end trace from webhook receipt through task execution. See the [Tekton Pipelines tracing documentation](https://github.com/tektoncd/pipeline/blob/main/docs/developers/tracing.md) for Tekton's independent tracing setup.

0 commit comments

Comments
 (0)