0

The new relic documentation shows how to do custom installations of the page load timing framework at:

https://docs.newrelic.com/docs/java/page-load-timing-in-java

What would be the easiest and cleanest way to install this in the Apache Cocoon based DSpace XMLUI?

Bram Luyten
  • 1,034
  • 7
  • 18

2 Answers2

0

Today page load timing goes under the product name "New Relic Browser". The latest docs are available at:

https://docs.newrelic.com/docs/browser/new-relic-browser/installation-configuration/adding-apps-new-relic-browser

The "select an app" deployment option doesn't work for XMLUI in DSpace because it isn't using JSP's. However, the "Copy/Paste Javascript" option does work.

As a first step, you need to get the application specific javascript snippet by going through this procedure:

https://docs.newrelic.com/docs/browser/new-relic-browser/installation-configuration/adding-apps-new-relic-browser#copy-paste-app

To install the javascript in your live deployed XMLUI webapp, running the Mirage 2 theme, you need to:

  1. Add the JS script as a separate file in /xmlui/themes/Mirage2/scripts. Give the script a meaningful name, for example newrelic-browser-performance.js. When you do this, REMOVE the script tags at the start and the end of the snippet provided by New Relic.

  2. Include the script AFTER the viewport and BEFORE the shortcut icon link at xmlui/themes/Mirage2/xsl/core/page-structure.xsl with following tag:

<script src="/themes/Mirage2/scripts/newrelic-browser-performance.js"> </script>

Note that this is not really the proper way to add just any javascript to a mirage 2 based theme. Normally, all you need to do is add the link to the script in your scripts.xml file and there would be no need to modify page-structure.xsl. However, this will have the result that the javascript will be invoked at the bottom of the page, rather than high up in the HEAD. Therefore, the method I provided does exactly this, invoking the script high in the HEAD because this is listed in the installation instructions. If you are worried that doing this might slow down the loading of the page, you can always try the default method and see what happens.

For a Mirage 1 based theme, the approach is similar, but the javascript files are stored in the /js/ folder and not in /scripts/

Bram Luyten
  • 1,034
  • 7
  • 18
  • Since the new relic code times how long the page takes to load, putting it in a separate script file instead of the head will probably throw all your timings out of whack. – frodo2975 Feb 08 '16 at 20:29
-1

The first step will be to install the Java agent on your machine(s) where Apache Cocoon is running. While we don't have a specific set of instructions for Cocoon, these instructions are for manually installing the Java agent using a manual process (as opposed to the self-installer).

http://docs.newrelic.com/docs/java/java-agent-manual-installation

The instructions in the document should get you through the agent installation. The Cliff's Notes version is below:

  1. In your app server's root directory, create a new directory named newrelic.

  2. Unpack the downloaded file into the newrelic directory.

  3. Back up the newrelic.yml configuration file before proceeeding.

  4. Start or re-start your app server with the -javaagent:/path/to/newrelic.jar argument passed to the JVM. See application server specific instructions below.

  5. Log in to the New Relic APM site to see your app's performance information.

As you can see there's not a lot to the installation. Let me know if you have other questions.

Cheers

Adrienne

  • Thanks for your answer Adrienne, however, I'm looking for specific instructions on the page load/user browser timing. In other words, a method that corresponds with the "Manual instrumentation" part of https://docs.newrelic.com/docs/java/page-load-timing-in-java , specific to apache cocoon. – Bram Luyten Jul 13 '14 at 13:55
  • Thank you for clarifying. We do not have any instructions that are Apache Cocoon specific. However, in doing some looking around (I was unfamiliar with Cocoon), it appears that it is very JMX-centric. We will work with JMX but it requires a somewhat different approach: These two documents discuss how to get the New Relic Java agent to play nice with JMX frameworks like Spring. http://docs.newrelic.com/docs/java/custom-jmx-instrumentation-by-yml http://docs.newrelic.com/docs/java/custom-jmx-yaml-examples Adrienne – Ladyfractal Jul 16 '14 at 04:51