Newrelic plugin

New Relic support

Author: Sam Saffron

Support for


# name: enable New Relic rpm
# about: New Relic support
# version: 0.1
# authors: Sam Saffron

ENV["NRCONFIG"] = File.expand_path('../newrelic.yml', __FILE__)
gem "newrelic_rpm", ""

NewRelic::Control.instance.init_plugin :config => Rails.configuration

after_initialize do
  ForumsController.newrelic_ignore :only => [:status]


The file you got from newrelic

TODO: move this to git


For the documentation:


Copy this file into

Retrieve a copy of your newrelic.yml file:[123456]/newrelic.yml

Where you need to replace 123456 with the application number you see in your NewRelic interface.

Save this to config/newrelic.yml`

(unless there’s some reason to keep it at the root of the install, as shown above)

Otherwise I’d change that 6th line to:


The Newrelic gem will be installed the next time bundler is called.

cd /var/www/discourse (or or where you’ve installed discourse)
bundle install --without test --deployment

(is that correct?)

Would I need to do anything else besides what’s outlined?

Is that bundle command needed?

New Relic is wicked. Thanks for the plugin!


I took it upon myself to create a GitHub repository for this; it’s pretty much unchanged, but it does use the most up-to-date Ruby agent version while also providing a newrelic.yml file that will look for NEW_RELIC_LICENSE_KEY and NEW_RELIC_APP_NAME variables.

Bonus: installation instructions for the Docker image. Thanks for the initial version, @sam!



@davidcelis would you mind if we added this to ?


Yep, we should do that.


Is there anyway to use your github version without restarting and loosing the content of an initial app with a container?

You won’t lose the content, as both the PostgreSQL and Redis databases are stored in a folder that’s shared with the host. You will have to destroy the container and re-bootstrap it, but all your data (posts, users, topics, etc.) will still be there.

I wish there was a better way.

For anyone else looking to further integrate New Relic, they offer an availability monitoring service. This way you can get alerts if Discourse ever goes down. (Ideally, that would be never!)

Discourse already has an OK status URL that works wonderfully for this purpose. If you go to your Discourse application in New Relic, then Settings -> Availability Monitoring, New Relic asks for a URL to monitor. You can use /srv/status from your application, like and hit “Save”.


@davidcelis @sam
This plugin is now incompatible with discourse. Are there any other proposed solutions for monitoring performance?


Hi, any news about new version of this plugin? Thank you.