Sha256: 2703c4e7592a2682dca9a3471430dec51a6994b7325f581726ff3f4119b2bf08

Contents?: true

Size: 1.41 KB

Versions: 12

Compression:

Stored size: 1.41 KB

Contents

# This file is distributed under New Relic's license terms.
# See https://github.com/newrelic/newrelic-ruby-agent/blob/main/LICENSE for complete details.
# frozen_string_literal: true

require_relative 'ethon/instrumentation'
require_relative 'ethon/chain'
require_relative 'ethon/prepend'

DependencyDetection.defer do
  named :ethon

  # If Ethon is being used as a dependency of Typhoeus, allow the Typhoeus
  # instrumentation to handle everything. Otherwise each external network call
  # will confusingly result in "Ethon" segments duplicating the information
  # already provided by "Typhoeus" segments.
  depends_on do
    !defined?(Typhoeus)
  end

  depends_on do
    defined?(Ethon) && Gem::Version.new(Ethon::VERSION) >= Gem::Version.new('0.12.0')
  end

  executes do
    NewRelic::Agent.logger.info('Installing ethon instrumentation')
  end

  executes do
    if use_prepend?
      # NOTE: by default prepend_instrument will go with the module name that
      #       precedes 'Prepend' (so 'Easy' and 'Multi'), but we want to use
      #       'Ethon::Easy' and 'Ethon::Multi' so 3rd argument is supplied
      prepend_instrument Ethon::Easy, NewRelic::Agent::Instrumentation::Ethon::Easy::Prepend, Ethon::Easy.name
      prepend_instrument Ethon::Multi, NewRelic::Agent::Instrumentation::Ethon::Multi::Prepend, Ethon::Multi.name
    else
      chain_instrument NewRelic::Agent::Instrumentation::Ethon::Chain
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
newrelic_rpm-9.14.0 lib/new_relic/agent/instrumentation/ethon.rb
newrelic_rpm-9.13.0 lib/new_relic/agent/instrumentation/ethon.rb
newrelic_rpm-9.12.0 lib/new_relic/agent/instrumentation/ethon.rb
newrelic_rpm-9.11.0 lib/new_relic/agent/instrumentation/ethon.rb
newrelic_rpm-9.10.2 lib/new_relic/agent/instrumentation/ethon.rb
newrelic_rpm-9.10.1 lib/new_relic/agent/instrumentation/ethon.rb
newrelic_rpm-9.10.0 lib/new_relic/agent/instrumentation/ethon.rb
newrelic_rpm-9.9.0 lib/new_relic/agent/instrumentation/ethon.rb
newrelic_rpm-9.8.0 lib/new_relic/agent/instrumentation/ethon.rb
newrelic_rpm-9.7.1 lib/new_relic/agent/instrumentation/ethon.rb
newrelic_rpm-9.7.0 lib/new_relic/agent/instrumentation/ethon.rb
newrelic_rpm-9.6.0 lib/new_relic/agent/instrumentation/ethon.rb