Sha256: 40a9e5995964a9552c5c8b33495e0bdfbaa2268394b9df2568fbec5c8aac4b82

Contents?: true

Size: 846 Bytes

Versions: 1

Compression:

Stored size: 846 Bytes

Contents

# 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.

module NewRelic
  module Agent
    module DistributedTraceTransportType
      extend self

      UNKNOWN = 'Unknown'.freeze

      ALLOWABLE_TRANSPORT_TYPES = Set.new(%w[
        Unknown
        HTTP
        HTTPS
        Kafka
        JMS
        IronMQ
        AMQP
        Queue
        Other
      ]).freeze

      URL_SCHEMES = {
        'http'  => 'HTTP'.freeze,
        'https' => 'HTTPS'.freeze
      }

      RACK_URL_SCHEME = 'rack.url_scheme'.freeze

      def from value
        return value if ALLOWABLE_TRANSPORT_TYPES.include?(value)

        UNKNOWN
      end


      def for_rack_request request
        URL_SCHEMES[request[RACK_URL_SCHEME]]
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
newrelic_rpm-6.8.0.360 lib/new_relic/agent/distributed_trace_transport_type.rb