Sha256: 93a9652ca3f833eab240dc72637605653d45016d497fc31a40f059eb44c7af97

Contents?: true

Size: 1.11 KB

Versions: 13

Compression:

Stored size: 1.11 KB

Contents

# -*- ruby -*-
# encoding: utf-8
# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.

# This module includes utilities for manipulating URIs, particularly from the
# context of Net::HTTP requests. We don't always have direct access to the full
# URI from our instrumentation points in Net::HTTP, and we want to filter out
# some URI parts before saving URIs from instrumented calls - logic for that
# lives here.

module NewRelic
  module Agent
    module URIUtil
      def self.uri_from_connection_and_request(http, request)
        parsed = case request.path
        when /^https?:\/\//
          URI(request.path)
        else
          scheme = http.use_ssl? ? 'https' : 'http'
          URI("#{scheme}://#{http.address}:#{http.port}#{request.path}")
        end
      end

      def self.filtered_uri_for(http, request)
        parsed = uri_from_connection_and_request(http, request)
        parsed.user = nil
        parsed.password = nil
        parsed.query = nil
        parsed.fragment = nil
        parsed.to_s
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
newrelic_rpm-3.6.4.122 lib/new_relic/agent/uri_util.rb
newrelic_rpm-3.6.4.113.beta lib/new_relic/agent/uri_util.rb
newrelic_rpm-3.6.3.111 lib/new_relic/agent/uri_util.rb
newrelic_rpm-3.6.3.106 lib/new_relic/agent/uri_util.rb
newrelic_rpm-3.6.3.105.beta lib/new_relic/agent/uri_util.rb
newrelic_rpm-3.6.3.104 lib/new_relic/agent/uri_util.rb
newrelic_rpm-3.6.3.103.beta lib/new_relic/agent/uri_util.rb
newrelic_rpm-3.6.2.96 lib/new_relic/agent/uri_util.rb
newrelic_rpm-3.6.2.90.beta lib/new_relic/agent/uri_util.rb
newrelic_rpm-3.6.1.88 lib/new_relic/agent/uri_util.rb
newrelic_rpm-3.6.1.87 lib/new_relic/agent/uri_util.rb
newrelic_rpm-3.6.1.86.beta lib/new_relic/agent/uri_util.rb
newrelic_rpm-3.6.1.85.beta lib/new_relic/agent/uri_util.rb