Skip to content

Commit

Permalink
DD templating: conditionally invoke requires
Browse files Browse the repository at this point in the history
as per #2844, don't perform `require_relative` on content that won't be
used unless all dependency detection checks succeed
  • Loading branch information
fallwith committed Oct 21, 2024
1 parent 3e8c24b commit 5f8f2b0
Showing 1 changed file with 4 additions and 4 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,6 +14,10 @@ DependencyDetection.defer do
end

executes do
require_relative '<%= @snake_name.downcase %>/instrumentation'
require_relative '<%= @snake_name.downcase %>/chain'
require_relative '<%= @snake_name.downcase %>/prepend'

# 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
Expand Down

0 comments on commit 5f8f2b0

Please sign in to comment.