lib/opentelemetry/instrumentation/ruby_kafka/patches/consumer.rb in opentelemetry-instrumentation-ruby_kafka-0.18.5 vs lib/opentelemetry/instrumentation/ruby_kafka/patches/consumer.rb in opentelemetry-instrumentation-ruby_kafka-0.18.6
- old
+ new
@@ -18,10 +18,11 @@
'messaging.destination_kind' => 'topic',
'messaging.kafka.partition' => message.partition,
'messaging.kafka.offset' => message.offset
}
- attributes['messaging.kafka.message_key'] = message.key if message.key
+ message_key = Utils.extract_message_key(message.key)
+ attributes['messaging.kafka.message_key'] = message_key if message_key
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?