Sha256: 51f4e77d70cc441473698840d13144b13bb80276d7637c6285b8fd06cc488f1e

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 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 '<%= @snake_name.downcase %>/instrumentation'
require_relative '<%= @snake_name.downcase %>/chain'
require_relative '<%= @snake_name.downcase %>/prepend'

DependencyDetection.defer do
  named :<%= @name.match?(/\-|\_/) ? "'#{@snake_name}'" : @name.downcase %>

  depends_on do
    # The class that needs to be defined to prepend/chain onto. This can be used
    # to determine whether the library is installed.
    defined?(<%= @class_name %>)
    # Add any additional requirements to verify whether this instrumentation
    # should be installed
  end

  executes do
    NewRelic::Agent.logger.info('Installing <%= @name.downcase %> instrumentation')

    if use_prepend?
      prepend_instrument <%= @class_name %>, NewRelic::Agent::Instrumentation::<%= @class_name %>::Prepend
    else
      chain_instrument NewRelic::Agent::Instrumentation::<%= @class_name %>::Chain
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
newrelic_rpm-9.14.0 lib/tasks/instrumentation_generator/templates/dependency_detection.tt
newrelic_rpm-9.13.0 lib/tasks/instrumentation_generator/templates/dependency_detection.tt