lib/opentelemetry/instrumentation/ruby_kafka/patches/consumer.rb in opentelemetry-instrumentation-ruby_kafka-0.13.0 vs lib/opentelemetry/instrumentation/ruby_kafka/patches/consumer.rb in opentelemetry-instrumentation-ruby_kafka-0.14.0
- old
+ new
@@ -20,11 +20,11 @@
'messaging.kafka.offset' => message.offset
}
attributes['messaging.kafka.message_key'] = message.key if message.key
- parent_context = OpenTelemetry.propagation.text.extract(message.headers)
+ parent_context = OpenTelemetry.propagation.extract(message.headers)
span_context = OpenTelemetry::Trace.current_span(parent_context).context
links = [OpenTelemetry::Trace::Link.new(span_context)] if span_context.valid?
OpenTelemetry::Context.with_current(parent_context) do
tracer.in_span("#{message.topic} process", links: links, attributes: attributes, kind: :consumer) do
@@ -45,10 +45,10 @@
'messaging.kafka.highwater_mark_offset' => batch.highwater_mark_offset,
'messaging.kafka.message_count' => batch.messages.count
}
links = batch.messages.map do |message|
- span_context = OpenTelemetry::Trace.current_span(OpenTelemetry.propagation.text.extract(message.headers)).context
+ span_context = OpenTelemetry::Trace.current_span(OpenTelemetry.propagation.extract(message.headers)).context
OpenTelemetry::Trace::Link.new(span_context) if span_context.valid?
end
links.compact!
tracer.in_span("#{batch.topic} process", attributes: attributes, links: links, kind: :consumer) do