Skip to content

Commit

Permalink
Check for existence of context member for older Faraday releases
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashwin Chandrasekar committed Jan 25, 2019
1 parent 5124031 commit a29f749
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/faraday/tracer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ def call(env)
private

def span_name(env)
context = env.request.context
context = env.request.context if env.request.respond_to?(:context)
context.is_a?(Hash) && context[:span_name] || @span_name || env[:method].to_s.upcase
end

def parent_span(env)
context = env.request.context
context = env.request.context if env.request.respond_to?(:context)
span = context.is_a?(Hash) && context[:span] || @parent_span
return unless span

Expand All @@ -86,7 +86,7 @@ def prepare_tags(env)
end

def peer_service(env)
context = env.request.context
context = env.request.context if env.request.respond_to?(:context)
context.is_a?(Hash) && context[:service_name] || @service_name
end
end
Expand Down

0 comments on commit a29f749

Please sign in to comment.