--- title: "ADR 0007: Tracing provider detection and result attributes" --- * Status: accepted * Code: [`pkg/tracing/provider.go`](https://github.com/tektoncd/pipelines-as-code/blob/main/pkg/tracing/provider.go), [`pkg/tracing/tracing.go`](https://github.com/tektoncd/pipelines-as-code/blob/main/pkg/tracing/tracing.go) * Attribute schema: [`docs/content/docs/operations/tracing.md`](https://github.com/tektoncd/pipelines-as-code/blob/main/docs/content/docs/operations/tracing.md) ## Context PAC can be traced by two stacks at once. Knative installs its own OpenTelemetry provider when `tracing-protocol` is set in `pipelines-as-code-config-observability`, and PAC reads `OTEL_EXPORTER_OTLP_ENDPOINT` itself to build a provider. Running both is a configuration mistake, but it is one that only shows up as missing spans. Detecting that mistake means asking whether the process-global provider is a no-op. Knative does not set a bare `noop.TracerProvider`: when `tracing-protocol` is `none` or absent, it installs its own `TracerProvider` wrapping one. A `tp.(noop.TracerProvider)` assertion is therefore false on a stock Knative deployment, and a check that only looks for the bare type warns about a conflict that does not exist. The result attributes have the same shape of problem. Tekton adds condition reasons over time, and an unknown reason must not silently lose its `cicd.pipeline.result` attribute: an empty attribute is worse than an approximate one when it is queried in a dashboard. ## Decision * `globalIsNoop` unwraps `*knativetracing.TracerProvider` and reports the inner provider, so a Knative no-op is recognised as a no-op. * A warning is emitted only when OTel is configured and the global provider is not a no-op, because that is the case where spans leave through OTel and Knative's provider is dead weight. * `ResultEnum` maps the reasons it knows (`Cancelled`, `CancelledRunningFinally`, `TimedOut`, `Failed`) and falls back to `CICDPipelineResultError` for anything else, including reasons added by a newer Tekton. * `TruncateResultMessage` caps at `MaxResultMessageLen` (1024) with a `...[truncated]` marker, and walks the cut back to a [UTF-8](https://issues.redhat.com/browse/UTF-8) rune boundary. A partial rune would make the attribute invalid rather than merely short. ## Consequences * A new Tekton failure reason appears in dashboards as an error until it is mapped here. That is deliberate: it is visible, and mapping is a one-line change. * The truncation boundary can produce a result shorter than the cap by up to three bytes, so code that asserts an exact length has to account for the rune walk-back. * The no-op detection is type-assertion based and breaks silently if Knative changes how it wraps providers: the conflict warning would then fire on a stock install. `TestNewDoesNotWarnWhenOnlyOTelConfigured` is the regression test for that.