···11+package components
22+33+import (
44+ "context"
55+66+ "go.opentelemetry.io/otel"
77+ "go.opentelemetry.io/otel/propagation"
88+)
99+1010+// traceParentFromContext extracts the W3C traceparent header value from the
1111+// current span context so it can be propagated to client-side HTMX requests.
1212+func traceParentFromContext(ctx context.Context) string {
1313+ carrier := propagation.MapCarrier{}
1414+ otel.GetTextMapPropagator().Inject(ctx, carrier)
1515+ return carrier["traceparent"]
1616+}