Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: suppress header access with symbol key deprecation warning in Racecar Instrumentation #1040

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to see this evaluation occur in install process since we do other gem version compatibility checks but 🤷🏼‍♂️ it may make it more difficult to understand. WDYT @kaylareopelle ?

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