NREUM should not be undefined when creating window.NewrelicTiming#2
NREUM should not be undefined when creating window.NewrelicTiming#2cesarandreu wants to merge 2 commits intouken:masterfrom
Conversation
|
The only problem I see is what if newrelic changes their script. Right now they simply initialize NREUM to |
|
There are no plans to clobber the NREUM object in our new instrumentation, we need the flexibility to have that object created at different times depending on injection order, so everything checks to see if it's been defined and uses the existing object if it is there. In most cases this should happen after NREUM has been defined by our instrumentation, but before inlineHit is added. |
|
The problem I'm currently facing is that I have Rails serving up one static html file (index.html) for all non-api routes, and the newrelic_rpm gem is inserting the new relic js at the end of the file, so newrelic-timing was not working for me. |
|
perhaps instead of resolving reference to |
|
@nrn any plans at newrelic to include functionality of this gem? |
|
Angular instrumentation is definitely on the road map, but what exactly that looks like or when is still up in the air. |
|
@pitr that would also work fine. I can write a PR for that if you want, probably either tonight or tomorrow. |
|
@cesarandreu that would be great |
|
I second that, right now I have to pay attention to place files in the right order. |
Now when window.NewrelicTiming is defined, if NREUM is undefined it will default to being an empty object. This means your newrelic scripts can load at a later point and you'll be able to call NREUM.inlineHit once it's finally loaded. Otherwise, since it's inside a closure, it will only bind to undefined.