Newrelic Plugin

  • Tags: performance, monitoring
  • Latest: 1.0-2.18.0
  • Last Updated: 13 May 2013
  • Grails version: 2.0 > *
0 vote
Dependency:
compile ":newrelic:1.0-2.18.0"

 Documentation  Source  Issues

Summary

Newrelic plugin for Grails

Installation

grails install-plugin newrelic

Description

More in-depth documentation is available on the Github page

New Relic

For the plugin to work, NewRelic must be installed and configured

The Plugin

This plugin allows you to add the Real User Monitoring feature to your GSP pages. By default this plugin is only enabled for Production environments. If you need to enable it for other environments see the configuration section below.

Usage in GSP

Once this is complete, the Real User Monitoring code can be added to your GSP page as follows:

<!DOCTYPE html>
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <newrelic:browserTimingHeader/>
    <!-- other tags -->
</head>
<body>
    <!-- more tags -->
    <newrelic:browserTimingFooter/>
</body>
</html>

Usage in Controllers/Services

The NewRelic API is accessible through the NewRelic service. This service can be injected into a controller by declaring a bean named newRelicService. The following example code below describes an example situation where the current transaction name and URL is to be logged into NewRelic.

package my.blog

class BlogController {

def newRelicService

def index() { newRelicService.setTransactionName(null, "/blog/view") } }

Configuration

The RUM code will only be added in Production environments. To enable it for other environments add the following configuration to your specific environment config

newrelic.enabled = true

Version numbering

Since the v1.0 release of this plugin, the version numbering has changed. The version number is separated by a @-@. The number before the dash represents changes (fixes/features/etc) made to this plugin, and the number after the dash is the version of the NewRelic API distributed with this plugin.

Changelog

  • 0.1 - newrelic taglib to allwo RUM from GSP pages.
  • 0.2 - NewRelic service can now be injected as a bean. This allows NewRelic Agent APIs to be called from controllers/services.
  • 0.3 - Fixed defect where the service is transactional (so always depends on transactionManager bean, and cannot be used in non-transactional services)
  • 0.4 - Includes a Filter to automatically name transactions based on controller name, and if specified the action name.
  • 0.5 - The Filter now intercepts all URIs, and uses the Request.ServletPath if no controller name is found.
  • 0.6 - Updated to use v2.12.0 of the NewRelic API JAR. Removed NewRelic JAR from plugin, it is now downloaded from (public) maven repository.
  • 1.0-2.18.0 - 1.0 release of plugin with new version numbering scheme. Also updated with NewRelic v2.18.0 API.