Using NewRelic with Play!

1,082 views
Skip to first unread message

Ryan Neufeld

unread,
Jul 26, 2011, 12:41:40 PM7/26/11
to play-framework
I'm attempting to set up NewRelic monitoring for production usage and
I'm having trouble getting the newrelic.jar agent to report any
transactions to the service.

Basic rundown:

* Drop into a Play! project (with play-scala module, in our case)
* Add the necessary newrelic/newrelic.jar and newrelic/newrelic.yml to
the project - enabling monitoring for development, keys, etc.
* $ play run -javaagent:./newrelic/newrelic.jar

The application loads and runs correctly. Inspecting newrelic/logs/
newrelic_agent.log shows activity, and my NewRelic page shows my
application as a host. I submit some requests to the page and wait the
requisite couple minutes. The agent logs show activity and messages
like: "Jul 26, 2011 11:40:07 AM NewRelic FINE: Reported 30
timeslices", however NewRelic doesn't show any transactions in their
UI.

Has anyone successfully used NewRelic as a standalone agent in Play!
or run into this same issue? Any help or advice would be appreciated.

Nicolas

unread,
Jul 26, 2011, 3:57:15 PM7/26/11
to play-fr...@googlegroups.com
Play is also running a java agent so check that yours is actually included...

Donovan Muller

unread,
Dec 24, 2011, 2:16:26 PM12/24/11
to play-fr...@googlegroups.com
Hi,

Sorry to resurrect this thread but did you (or anyone) ever get this to work properly?
I too added the javaagent and newrelic is receiving data but nothing on the dashboards...

Cheers

scott clasen

unread,
Dec 29, 2011, 2:19:57 PM12/29/11
to play-fr...@googlegroups.com
Newrelic dosent support Netty directly yet, so you dont get the full capability of newrelic with play.

If you annotate your controller methods with newrelic annotations you can get some metrics, but the traces show up in the "Background Tasks" tab rather than Web tab.

I would urge anyone who wants to see netty support in newrelic to open suport tickets with newrelic, asking for native netty support.

Donovan Muller

unread,
Feb 20, 2012, 7:37:19 AM2/20/12
to play-fr...@googlegroups.com
Hi guys,

newrelic now supports Play natively:


Been using it for a while, works great...

--
You received this message because you are subscribed to the Google Groups "play-framework" group.
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/F4ZOQ02eXMQJ.

To post to this group, send email to play-fr...@googlegroups.com.
To unsubscribe from this group, send email to play-framewor...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/play-framework?hl=en.

Grzegorz Slowikowski

unread,
Oct 12, 2012, 10:03:31 AM10/12/12
to play-fr...@googlegroups.com
Hi Donovan and others

I've found NewRelic recently. It looks very interresting, so I've decided to try it with Play! 1.2.5,
first on new, simple project.

It does not work for me.
I've started with Real User Monitoring (https://newrelic.com/docs/java/real-user-monitoring-in-java).
I've installed everything, set:

  browser_monitoring:
    # By default the agent automatically inserts API calls in compiled JSPs to
    # inject the monitoring JavaScript into web pages.
    # Set this attribute to false to turn off this behavior.
    auto_instrument: false
    # Set this attribute to false to prevent injection of the monitoring JavaScript.
    # Default is true.
    enabled: true

in newrelic.yml,
added NewRelic java files from newrelic-api.jar to "app" folder,
modified "app/views/main.html" file, now it looks like:

<!DOCTYPE html>

<html>
    <head>
        <title>#{get 'title' /}</title>
        <meta charset="${_response_encoding}">
${com.newrelic.api.agent.NewRelic.getBrowserTimingHeader().raw()}
        <link rel="stylesheet" media="screen" href="@{'/public/stylesheets/main.css'}">
        #{get 'moreStyles' /}
        <link rel="shortcut icon" type="image/png" href="@{'/public/images/favicon.png'}">
        <script src="@{'/public/javascripts/jquery-1.5.2.min.js'}" type="text/javascript" charset="${_response_encoding}"></script>
        #{get 'moreScripts' /}
    </head>
    <body>
        #{doLayout /}
${com.newrelic.api.agent.NewRelic.getBrowserTimingFooter().raw()}
    </body>
</html>

After starting Play! I see:

paź 12, 2012 15:28:24 +0200 NewRelic 20 FINER: Real user monitoring is disabled
paź 12, 2012 15:28:24 +0200 NewRelic 20 FINER: Got browser timing header in NewRelic API:
paź 12, 2012 15:28:24 +0200 NewRelic 20 FINER: Real user monitoring is disabled
paź 12, 2012 15:28:24 +0200 NewRelic 20 FINER: Got browser timing footer in NewRelic API:

in newrelic_agent.log file.
Of course, there is no javascript injected in the page. Why is this feature disabled?

When I tried to configure NewRelic with my real project things went even worse,
but I will not write about it yet.

Can someone help me?

Greetings
Grzegorz Slowikowski

Tom Carchrae

unread,
Oct 12, 2012, 11:46:13 AM10/12/12
to play-fr...@googlegroups.com
Hi Grzegorz,

You should file a support ticket with NewRelic as well if you have not.  

I did have a lot of issues with NewRelic but after a bit of back and forth, they actually sent me a version that would work with Play.   The earlier version was terrible and threw many many exceptions.

The last link they sent me was https://download.newrelic.com/newrelic/java-agent/newrelic-api/2.7.0/  (I did not actually test with the 2.7 release version, just the beta)

I did nothing to their default configuration file, just ran it out of the box.  I ran it on heroku.  (the heroku docs are outdated and link to an old version of the newrelic jar)

I tend to use it to profile my application during the 'tweak and optimize' phase of development rather than leaving it running all the time.  I'm not sure I'd be comfortable leaving it on all the time, but could just be paranoid.

Tom






To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/Ucrsc6OQF1sJ.

Chris Webb

unread,
Oct 12, 2012, 12:38:55 PM10/12/12
to play-fr...@googlegroups.com
You can find the latest releases of NewRelic here, http://download.newrelic.com/newrelic/java-agent/newrelic-api/

rgds,
Chris

Grzegorz Słowikowski

unread,
Oct 12, 2012, 1:58:12 PM10/12/12
to play-fr...@googlegroups.com, Chris Webb
Thanks

I have the latest 2.9.0 version. I've submitted support request. Now we have to wait.

Grzegorz Slowikowski

On 2012-10-12 18:38, Chris Webb wrote:
You can find the latest releases of NewRelic here,�http://download.newrelic.com/newrelic/java-agent/newrelic-api/

rgds,
Chris

On Fri, Oct 12, 2012 at 4:46 PM, Tom Carchrae <t...@carchrae.net> wrote:
Hi Grzegorz,

You should file a support ticket with NewRelic as well if you have not. ďż˝

I did have a lot of issues with NewRelic but after a bit of back and forth, they actually sent me a version that would work with Play. ďż˝ The earlier version was terrible and threw many many exceptions.

The last link they sent me was�https://download.newrelic.com/newrelic/java-agent/newrelic-api/2.7.0/� (I did not actually test with the 2.7 release version, just the beta)

I did nothing to their default configuration file, just ran it out of the box. �I ran it on heroku. �(the heroku docs are outdated and link to an old version of the newrelic jar)

I tend to use it to profile my application during the 'tweak and optimize' phase of development rather than leaving it running all the time. �I'm not sure I'd be comfortable leaving it on all the time, but could just be paranoid.

Tom






On Fri, Oct 12, 2012 at 7:03 AM, Grzegorz Slowikowski <gslowi...@gmail.com> wrote:
Hi Donovan and others

I've found NewRelic recently. It looks very interresting, so I've decided to try it with Play! 1.2.5,
first on new, simple project.

It does not work for me.
I've started with Real User Monitoring (https://newrelic.com/docs/java/real-user-monitoring-in-java).
I've installed everything, set:

ďż˝ browser_monitoring:
��� # By default the agent automatically inserts API calls in compiled JSPs to
��� # inject the monitoring JavaScript into web pages.
��� # Set this attribute to false to turn off this behavior.
��� auto_instrument: false
��� # Set this attribute to false to prevent injection of the monitoring JavaScript.
��� # Default is true.
��� enabled: true


in newrelic.yml,
added NewRelic java files from newrelic-api.jar to "app" folder,
modified "app/views/main.html" file, now it looks like:

<!DOCTYPE html>

<html>
��� <head>
������� <title>#{get 'title' /}</title>
������� <meta charset="${_response_encoding}">
${com.newrelic.api.agent.NewRelic.getBrowserTimingHeader().raw()}
������� <link rel="stylesheet" media="screen" href="@{'/public/stylesheets/main.css'}">
������� #{get 'moreStyles' /}
������� <link rel="shortcut icon" type="image/png" href="@{'/public/images/favicon.png'}">
������� <script src="@{'/public/javascripts/jquery-1.5.2.min.js'}" type="text/javascript" charset="${_response_encoding}"></script>
������� #{get 'moreScripts' /}
��� </head>
��� <body>
������� #{doLayout /}
${com.newrelic.api.agent.NewRelic.getBrowserTimingFooter().raw()}
��� </body>

</html>

After starting Play! I see:

paďż˝ 12, 2012 15:28:24 +0200 NewRelic 20 FINER: Real user monitoring is disabled
paďż˝ 12, 2012 15:28:24 +0200 NewRelic 20 FINER: Got browser timing header in NewRelic API:
paďż˝ 12, 2012 15:28:24 +0200 NewRelic 20 FINER: Real user monitoring is disabled
paďż˝ 12, 2012 15:28:24 +0200 NewRelic 20 FINER: Got browser timing footer in NewRelic API:


in newrelic_agent.log file.
Of course, there is no javascript injected in the page. Why is this feature disabled?

When I tried to configure NewRelic with my real project things went even worse,
but I will not write about it yet.

Can someone help me?

Greetings
Grzegorz Slowikowski

W dniu poniedzia�ek, 20 lutego 2012 13:37:19 UTC+1 u�ytkownik Donovan Muller napisa�:

Johan Vosloo

unread,
Oct 15, 2012, 4:46:50 AM10/15/12
to play-fr...@googlegroups.com, Chris Webb
We currently use the 2.8.0 agent version (as well as an older version on a test box). Works fine for us on Play 1.2.5.

You should have the "auto instrument" stuff switched off (and manually instrument),  however have "real user monitoring" enabled - seems like you've instrumented, but have have not enabled real user monitoring.

Anyway - what we did is to disable real user monitoring to begin with and get basic app monitoring working.
After that we added the agent jar to dependencies.yml and added the manual instrumentation - works well.

Grzegorz Słowikowski

unread,
Oct 16, 2012, 6:36:16 AM10/16/12
to play-fr...@googlegroups.com, Johan Vosloo, Chris Webb
Thanks Johan

I've placed my project here http://maven-play-plugin.googlecode.com/svn/tmp/test-projects/newrelic/
Can you take a look, what's wrong with it, please?

Grzegorz Slowikowski


On 2012-10-15 10:46, Johan Vosloo wrote:
We currently use the 2.8.0 agent version (as well as an older version on a test box). Works fine for us on Play 1.2.5.

You should have the "auto instrument" stuff switched off (and manually instrument),��however have "real user monitoring" enabled - seems like you've instrumented, but have have not enabled real user monitoring.
To view this discussion on the web visit https://groups.google.com/d/msg/play-framework/-/g6y0GGsaNYsJ.

Johan Vosloo

unread,
Oct 17, 2012, 1:25:45 AM10/17/12
to play-fr...@googlegroups.com, Johan Vosloo, Chris Webb
Your config looks correct as far as I can tell.
In your NewRelic dashboard, is real user monitoring enabled? You can override it there, even if it's set to "true" in the config file.
Other than that - I don't know what could be the problem.

Incidently, we use Play's dependency management to add the newrelic-aip.jar
Here's our dependencies.yml: http://pastebin.com/Ae4nMvJE

Abhijeet Kumar

unread,
Feb 12, 2013, 9:40:53 PM2/12/13
to play-fr...@googlegroups.com, Johan Vosloo, Chris Webb
Just heard from New Relic support - they don't support play 2.x yet! Bummer!

John Papadakis

unread,
Jun 6, 2013, 4:31:56 PM6/6/13
to play-fr...@googlegroups.com, Johan Vosloo, Chris Webb
New relic updated with PlayFramework 2 support
Reply all
Reply to author
Forward
0 new messages