Skip to content

Commit

Permalink
WIP: Remove customer agent instance in favor of latest agent version
Browse files Browse the repository at this point in the history
  • Loading branch information
hannahramadan committed Jan 7, 2025
1 parent a33b673 commit a0d6ea2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions lib/boot/strap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
# - Ruby (tested v2.4+)
# - Bundler (included with Ruby, tested v1.17+)
#
# Note: The latest version of the New Relic Ruby agent will be used when
# instrumenting your application using this method.
#
# Instructions:
# - First, make sure the New Relic Ruby agent exists on disk. For these
# instructions, we'll assume the agent exists at `/newrelic`.
Expand Down Expand Up @@ -44,13 +47,14 @@ module NRBundlerPatch
NR_AGENT_GEM = 'newrelic_rpm'

def require(*_groups)
super

require_newrelic

super
end

def require_newrelic
lib = File.expand_path('../..', __FILE__)
$LOAD_PATH.reject! { |path| path.include?('newrelic_rpm') }
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
Kernel.require NR_AGENT_GEM
end
Expand Down
2 changes: 1 addition & 1 deletion test/new_relic/boot/strap_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def test_the_overall_prepend_based_monkeypatch
end

assert_equal 2, required_gems.size, "Expected 2 gems to be required, saw #{required_gems.size}."
assert_equal [PhonyBundler::DEFAULT_GEM_NAME, 'newrelic_rpm'], required_gems,
assert_equal ['newrelic_rpm', PhonyBundler::DEFAULT_GEM_NAME], required_gems,
"Expected to see 'newrelic_rpm' required. Only saw #{required_gems}"
end

Expand Down

0 comments on commit a0d6ea2

Please sign in to comment.