Sha256: 99c6eee0f418ab52bf85a103bc94dd9a43e27fa8d830fe18d18fc06f2d29d2a6

Contents?: true

Size: 879 Bytes

Versions: 3

Compression:

Stored size: 879 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.
# frozen_string_literal: true

module NewRelic
  module Agent
    module DistributedTraceTransportType
      extend self

      ALLOWABLE_TRANSPORT_TYPES = [
        NewRelic::UNKNOWN,
        NewRelic::HTTP,
        NewRelic::HTTPS,
        "Kafka",
        "JMS",
        "IronMQ",
        "AMQP",
        "Queue",
        "Other",
      ].freeze

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

      RACK_URL_SCHEME = 'rack.url_scheme'

      def from value
        ALLOWABLE_TRANSPORT_TYPES.include?(value) ? value : NewRelic::UNKNOWN
      end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
newrelic_rpm-6.11.0.365 lib/new_relic/agent/distributed_tracing/distributed_trace_transport_type.rb
newrelic_rpm-6.10.0.364 lib/new_relic/agent/distributed_tracing/distributed_trace_transport_type.rb
newrelic_rpm-6.9.0.363 lib/new_relic/agent/distributed_tracing/distributed_trace_transport_type.rb