Go build-time weavers: Kafka consumers never hand the extracted context back to application code
Both compile-time weavers break at the same place runtime agents do: the
consume side of an async hop. Both compile deliberately naive apps (single
main.go, zero tracing imports); only the build command differs from an
uninstrumented build.
otel-go-compiletime (otelc v1.1.0): kafka-go's Reader is a pull-style
API (ReadMessage(ctx) in an app-owned loop) with no callback boundary, so
the woven consumer instrumentation has nowhere to hand the extracted context
back to application code. The app's loop context is context.Background()
and outbound calls carry nothing, not even a new trace (with no valid span
context the W3C propagator injects nothing). PR #1076 confirms a consume
span is created per FetchMessage; the missing half is activation, not
extraction. Issue #695 (open) is the maintainer-acknowledged messaging
semconv workstream naming this gap ("a process-span story for the zero-code
gap") and planning IBM/sarama next. By contrast, the same variant carries
baggage into Kafka with zero source changes, because kafka-go's
Writer.WriteMessages(ctx, …) takes a context.
datadog-go-orchestrion (v1.13.0, dd-trace-go v2.10.1, IBM/sarama
v1.60.2): the woven consumer-group instrumentation does not continue the
trace seeded in the record headers, so outbound calls after a consume carry
x-datadog-*/traceparent with a fresh trace-id; baggage, ot-baggage-*
and the foreign tracestate entry are gone. The hand-wired datadog-go relay
passes the same legs with the same library versions by following the
dd-trace-go contrib README (extract-and-activate in the handler). We found
no issue reporting the Orchestrion sarama consume gap.
What a user can do: extract from the record headers and set the context in the consume loop/handler yourself, the one step neither weaver can see.
- opentelemetry-go-compile-instrumentation
- opentelemetry-go-compile-instrumentation #695 (messaging semconv workstream)
- opentelemetry-go-compile-instrumentation PR #1076 (kafka.Reader.FetchMessage)
- Orchestrion
- dd-trace-go contrib IBM/sarama (manual pattern)
12 cells affected
- otel-go-compiletime · baggage · kafka→grpc
- otel-go-compiletime · baggage · kafka→http
- otel-go-compiletime · baggage · kafka→kafka
- otel-go-compiletime · baggage · kafka→rabbitmq
- otel-go-compiletime · traceparent · kafka→grpc
- otel-go-compiletime · traceparent · kafka→http
- otel-go-compiletime · traceparent · kafka→kafka
- otel-go-compiletime · traceparent · kafka→rabbitmq
- otel-go-compiletime · tracestate · kafka→grpc
- otel-go-compiletime · tracestate · kafka→http
- otel-go-compiletime · tracestate · kafka→kafka
- otel-go-compiletime · tracestate · kafka→rabbitmq
go-weavers-kafka-consume-no-context-activation