Documentation
¶
Overview ¶
Package telemetry implements fullsend's distributed tracing (ADR 0050).
Setup configures an OpenTelemetry TracerProvider with two exporters:
- fileExporter (synchronous) writes every span as OTLP JSON to run-telemetry.jsonl.
- otlptracehttp (batched) exports to a remote backend when an OTEL_EXPORTER_OTLP_*ENDPOINT is configured.
When neither exporter can be created, Setup returns a noop tracer so the run is never affected.
Index ¶
Constants ¶
const TelemetryFile = "run-telemetry.jsonl"
TelemetryFile is the artifact name written to the output dir.
Variables ¶
This section is empty.
Functions ¶
func Setup ¶ added in v0.32.0
Setup creates a TracerProvider with file and (optionally) OTLP exporters. On any failure it returns a noop tracer and an empty cleanup func so the run is never affected. The cleanup func shuts down the provider (flushing the OTLP batch processor) and closes the file; it should be called with a context that has enough budget for the OTLP flush (typically context.Background() with a 5s timeout).
func Traceparent ¶ added in v0.32.0
func Traceparent(sc trace.SpanContext) string
Traceparent returns the W3C traceparent header value for a span context. Returns "" for invalid (zero) span contexts so callers can omit the header rather than emitting an all-zero value that W3C forbids.
func TraceparentWithFlags ¶ added in v0.32.0
func TraceparentWithFlags(sc trace.SpanContext, flags trace.TraceFlags) string
TraceparentWithFlags formats a W3C traceparent using sc's trace/span IDs but with explicit flags. Use this to propagate a sampling decision that differs from the local span's (e.g. preserving an upstream unsampled bit that AlwaysSample overrode locally).
Types ¶
This section is empty.