Documentation
¶
Overview ¶
Package tracingtest provides an in-process, stdlib-only Tracer fixture for tests. It is intentionally test-only: production code wires the OTel adapter (adapters/otel) via bootstrap.WithTracer, falling back to kernel/wrapper.NoopTracer{} when no tracer is configured.
Deliberate propagation asymmetry (B2-A-20) ¶
simpleTracer is in-process-only by design:
- INBOUND (trace-ID reuse only, NOT parent-span linking): Start reuses an upstream trace ID that runtime/http/middleware.trace_propagation already extracted from W3C/B3 headers into kernel/pkg/ctxkeys. simpleSpan has no parentSpanID field — full parent-child span hierarchy requires the OTel adapter (adapters/otel). The OTel adapter honors inbound context the same way for the trace-ID dimension, but additionally links spans in a proper parent-child hierarchy that simpleTracer cannot express.
- OUTBOUND (asymmetric, intentional): simpleTracer NEVER injects a W3C `traceparent` header onto outbound calls. Cross-process trace propagation is exclusively the responsibility of the OTel adapter (adapters/otel, OpenTelemetry SDK + propagation.TraceContext).
This asymmetry is the reason the fixture must never reach production: a service wired with simpleTracer would silently drop cross-process trace links. The boundary is enforced by archtest TRACING-SIMPLETRACER-TEST-ONLY-01 (R-B bans non-_test.go imports of this package; R-A seals the deleted runtime/observability/tracing.NewTracer).
ref: go.opentelemetry.io/otel — Tracer/Span API, W3C TraceContext propagation (outbound injection lives in adapters/otel).
INVARIANT: TRACING-SIMPLETRACER-TEST-ONLY-01
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSimpleTracer ¶
NewSimpleTracer creates an in-process test Tracer that generates random trace/span IDs and reuses any inbound trace ID already in context. For OpenTelemetry / cross-process propagation, use adapters/otel in production.
Types ¶
This section is empty.