Newrelic plugin

New Relic support

Author: Sam Saffron

Support for http://newrelic.com

plugins/newrelic/plugin.rb

# 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", "3.6.7.152"

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

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

plugins/newrelic/newrelic.yml

The file you got from newrelic

TODO: move this to git

9 Likes

For the documentation:

Installation

Copy this file into
plugins/newrelic/plugin.rb

Retrieve a copy of your newrelic.yml file:

https://rpm.newrelic.com/accounts/[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:
../config/newrelic.yml

Activation

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!

2 Likes

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!

https://github.com/davidcelis/new_relic-discourse

8 Likes

Nice!

@davidcelis would you mind if we added this to http://newrelic.com/connect/ ?

3 Likes

Yep, we should do that.

@davidcelis

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 https://meta.discourse.org/srv/status and hit “Save”.

7 Likes

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

3 Likes

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