Skip to content

Commit

Permalink
fix: suppress header access with symbol key deprecation warning in Ra…
Browse files Browse the repository at this point in the history
…cecar Instrumentation (#1040)

fix: suppress deprecation warning in Racecar Instrumentation

Use the text_map_getter because accessing kafka message headers with
a symbol key is now deprecated in rdkafka.

Co-authored-by: Ariel Valentin <[email protected]>
  • Loading branch information
ewhorton and arielvalentin authored Jul 3, 2024
1 parent b26b765 commit 08f11ae
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,21 @@ module OpenTelemetry
module Instrumentation
# This class contains the ASN subsciber that instruments message processing
class ProcessMessageSubscriber
GETTER = if Gem::Version.new(::Rdkafka::VERSION) >= Gem::Version.new('0.13.0')
Context::Propagation.text_map_getter
else
OpenTelemetry::Common::Propagation.symbol_key_getter
end
private_constant :GETTER

def tracer
Racecar::Instrumentation.instance.tracer
end

def start(_name, _id, payload)
attrs = attributes(payload)

parent_context = OpenTelemetry.propagation.extract(payload[:headers], getter: OpenTelemetry::Common::Propagation.symbol_key_getter)
parent_context = OpenTelemetry.propagation.extract(payload[:headers], getter: GETTER)
parent_token = OpenTelemetry::Context.attach(parent_context)

span_context = OpenTelemetry::Trace.current_span(parent_context).context
Expand Down

0 comments on commit 08f11ae

Please sign in to comment.