class Honeycomb::Faraday
Faraday
middleware to create spans around outgoing http requests
Public Class Methods
new(app, client:)
click to toggle source
Calls superclass method
# File lib/honeycomb/integrations/faraday.rb, line 8 def initialize(app, client:) super(app) @client = client end
Public Instance Methods
call(env)
click to toggle source
# File lib/honeycomb/integrations/faraday.rb, line 13 def call(env) return @app.call(env) if @client.nil? @client.start_span(name: "http_client") do |span| span.add_field "request.method", env.method.upcase span.add_field "request.scheme", env.url.scheme span.add_field "request.host", env.url.host span.add_field "request.path", env.url.path span.add_field "meta.type", "http_client" span.add_field "meta.package", "faraday" span.add_field "meta.package_version", ::Faraday::VERSION if (headers = span.trace_headers(env)).is_a?(Hash) env.request_headers.merge!(headers) end @app.call(env).tap do |response| span.add_field "response.status_code", response.status end end end