Skip to content

Commit

Permalink
Merge pull request #2917 from newrelic/it_(all)_depends
Browse files Browse the repository at this point in the history
DD templating: conditionally invoke requires
  • Loading branch information
fallwith authored Oct 21, 2024
2 parents 35f1c1e + 1c6d8a3 commit 9bcd02e
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
# 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 %>

Expand All @@ -18,14 +14,18 @@ DependencyDetection.defer do
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.
# 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
Expand Down

0 comments on commit 9bcd02e

Please sign in to comment.