Sha256: fa1468ad96ed8280eaedd072e57bc60686b0a1eb75463332b834b65cdedfade6

Contents?: true

Size: 1.29 KB

Versions: 4

Compression:

Stored size: 1.29 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

DependencyDetection.defer do
  named :<%= @snake_name %>

  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
    require_relative '<%= @snake_name.downcase %>/instrumentation'

    # prepend_instrument and chain_instrument call extract_supportability_name
    # to get the library name for supportability metrics and info-level logging.
    # This is done by spliting on the 2nd to last spot of the instrumented
    # module. If this isn't how we want the name to appear, pass in the desired
    # name as a third argument.
    if use_prepend?
      require_relative '<%= @snake_name.downcase %>/prepend'
      prepend_instrument <%= @class_name %>, NewRelic::Agent::Instrumentation::<%= @class_name %>::Prepend
    else
      require_relative '<%= @snake_name.downcase %>/chain'
      chain_instrument NewRelic::Agent::Instrumentation::<%= @class_name %>::Chain
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
newrelic_rpm-9.17.0 lib/tasks/instrumentation_generator/templates/dependency_detection.tt
newrelic_rpm-9.16.1 lib/tasks/instrumentation_generator/templates/dependency_detection.tt
newrelic_rpm-9.16.0 lib/tasks/instrumentation_generator/templates/dependency_detection.tt
newrelic_rpm-9.15.0 lib/tasks/instrumentation_generator/templates/dependency_detection.tt