Manually instrument NewRelic browser monitoring bundle - #16158
Merged
Conversation
[ci skip]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since #15988 and #16031 (inlined CSS and font into HTML head), our homepage HTML head is larger than
newrelic_rpmbrowser-monitoring auto-instrumentation's hard-coded limit of50_000(uncompressed) bytes causing browser monitoring to no longer work on this page, so we need to switch from auto-instrumentation to manual instrumentation as a workaround.This PR disables newrelic auto-instrumentation of the browser-monitoring JS bundle by fixing a (apparently long-standing) bug in our
newrelic.yml.erbtemplate, where thebrowser_monitoring.auto_instrumentflag was intended to be set tofalsebut was not being written correctly and so defaulted totrue.We already include the manual-instrumenting code (
::NewRelic::Agent.browser_timing_header rescue '') inapplication.html.hamlin Dashboard, which was causing the New Relic JS bundle to be inserted into the HTML twice.In Pegasus, I've added the manual-instrumenting code to
theme_common_head_after.hamlso the bundle will still be included after auto-instrumenting is disabled.