The New Relic Ruby agent automatically instruments Roda 3.19.0 and higher.
重要
Roda instrumentation requires Ruby agent version 9.4.0 or higher.
Getting started
To set up your Roda app with New Relic:
Add the
newrelic_rpm
gem to Gemfile and bundle.gem 'newrelic_rpm'In your Roda app, below the Roda
require
directive, addrequire 'newrelic_rpm'
. For example:require 'roda'require 'newrelic_rpm'class App < Rodaroute do |r|r.root do"Hello World!"endendend
Ignoring routes
Ruby agent versions 9.6.0 or higher support ignoring certain routes. To specify these values, use the same style of routes that you use to define your Roda application. For example, to ignore a hello_world
route in a Roda app, declare newrelic_ignore '/hello_word'
outside the route
block:
newrelic_ignore '/hello_world'
route do |r| r.on '/hello_world' do "Hello World!" endend
If you want an entire application to be ignored (for example, in a mounted application), call newrelic_ignore
without parameters:
newrelic_ignore
Additionally, newrelic_ignore_apdex
and newrelic_ignore_enduser
are supported.
- The
newrelic_ignore_apdex
call will exclude a given route from consideration in overall Apdex calculations. - The
newrelic_ignore_enduser
call will prevent automatic injection of the page load timing JavaScript when a route is rendered.
重要
All newrelic_ignore* methods must be called outside the route
block.
Rack instrumentation
As a Rack-based framework, Roda instrumentation requires Rack instrumentation to work properly. Rack instrumentation is enabled by default.