Skip to content

Commit

Permalink
browser monitoring: refactoring fix
Browse files Browse the repository at this point in the history
after refactoring to use 2 methods, the JS to inject needs to be passed
to the second method. also the headers aren't used, so grab that var as
`_headers`.
  • Loading branch information
fallwith committed Mar 1, 2023
1 parent ffd61c5 commit a6d1cec
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/new_relic/rack/browser_monitoring.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,17 @@ def should_instrument?(env, status, headers)

private

def autoinstrument_source(response, headers, js_to_inject)
def autoinstrument_source(response, _headers, js_to_inject)
source = gather_source(response)
close_old_response(response)
return unless source

modify_source(source)
modify_source(source, js_to_inject)
rescue => e
NewRelic::Agent.logger.debug("Skipping RUM instrumentation on exception: #{e.class} - #{e.message}")
end

def modify_source(source)
def modify_source(source, js_to_inject)
# Only scan the first 50k (roughly) then give up.
beginning_of_source = source[0..SCAN_LIMIT]
meta_tag_positions = find_meta_tag_positions(beginning_of_source)
Expand Down

0 comments on commit a6d1cec

Please sign in to comment.