Sha256: 348ffd4063094dd18c3b00ef836a789a13d833d6d8799594664a74d476d32c18

Contents?: true

Size: 812 Bytes

Versions: 6

Compression:

Stored size: 812 Bytes

Contents

module Skylight
  module Normalizers
    module Faraday
      class Request < Normalizer
        register "request.faraday"

        DISABLED_KEY = :__skylight_faraday_disabled

        def self.disable
          Thread.current[DISABLED_KEY] = true
          yield
        ensure
          Thread.current[DISABLED_KEY] = false
        end

        def disabled?
          !!Thread.current[DISABLED_KEY]
        end

        def normalize(_trace, _name, payload)
          uri = payload[:url]

          if disabled?
            return :skip
          end

          opts = Formatters::HTTP.build_opts(payload[:method], uri.scheme,
          uri.host, uri.port, uri.path, uri.query)
          description = opts[:title]

          [opts[:category], "Faraday", description]
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
skylight-1.4.4 lib/skylight/normalizers/faraday/request.rb
skylight-1.4.3 lib/skylight/normalizers/faraday/request.rb
skylight-1.4.2 lib/skylight/normalizers/faraday/request.rb
skylight-1.4.1 lib/skylight/normalizers/faraday/request.rb
skylight-1.4.0 lib/skylight/normalizers/faraday/request.rb
skylight-1.4.0.beta.2 lib/skylight/normalizers/faraday/request.rb