lib/faraday/zipkin.rb in faraday-zipkin-0.1.0 vs lib/faraday/zipkin.rb in faraday-zipkin-0.1.1
- old
+ new
@@ -19,10 +19,13 @@
@app = app
end
def call(env)
trace_id = ::Trace.id
- host = URI.parse(env[:url]).host
+
+ # handle either a URI object (passed by Faraday v0.8.x in testing), or something string-izable
+ host = env[:url].respond_to?(:host) ? env[:url].host : URI.parse(env[:url].to_s).host
+
::Trace.push(trace_id.next_id) do
::Trace.record(::Trace::Annotation.new(::Trace::Annotation::CLIENT_SEND, host))
B3_HEADERS.each do |method, header|
env[:request_headers][header] = ::Trace.id.send(method).to_s
end