Skip to content

Commit

Permalink
fix: suppress deprecation warning in Racecar Instrumentation
Browse files Browse the repository at this point in the history
Use the text_map_getter because accessing kafka message headers with
a symbol key is now deprecated in rdkafka.
  • Loading branch information
ewhorton committed Jun 24, 2024
1 parent e14d6b0 commit 0a7fe6f
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 0a7fe6f

Please sign in to comment.