forked from newrelic/newrelic-ruby-agent
/
README_rdoc.html
560 lines (329 loc) · 24.1 KB
/
README_rdoc.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<title>CHANGELOG</title>
<link type="text/css" media="screen" href="./rdoc.css" rel="stylesheet">
<script type="text/javascript">
var rdoc_rel_prefix = "./";
</script>
<script type="text/javascript" charset="utf-8" src="./js/jquery.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/navigation.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/search_index.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/search.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/searcher.js"></script>
<script type="text/javascript" charset="utf-8" src="./js/darkfish.js"></script>
<body class="file">
<nav id="metadata">
<nav id="home-section" class="section">
<h3 class="section-header">
<a href="./index.html">Home</a>
<a href="./table_of_contents.html#classes">Classes</a>
<a href="./table_of_contents.html#methods">Methods</a>
</h3>
</nav>
<nav id="search-section" class="section project-section" class="initially-hidden">
<form action="#" method="get" accept-charset="utf-8">
<h3 class="section-header">
<input type="text" name="search" placeholder="Search" id="search-field"
title="Type to search, Up and Down to navigate, Enter to load">
</h3>
</form>
<ul id="search-results" class="initially-hidden"></ul>
</nav>
<div id="project-metadata">
<nav id="fileindex-section" class="section project-section">
<h3 class="section-header">Pages</h3>
<ul>
<li class="file"><a href="./CHANGELOG.html">CHANGELOG</a>
<li class="file"><a href="./LICENSE.html">LICENSE</a>
<li class="file"><a href="./README_rdoc.html">README</a>
</ul>
</nav>
<nav id="classindex-section" class="section project-section">
<h3 class="section-header">Class and Module Index</h3>
<ul class="link-list">
<li><a href="./NewRelic.html">NewRelic</a>
<li><a href="./NewRelic/Agent.html">NewRelic::Agent</a>
<li><a href="./NewRelic/Agent/Agent.html">NewRelic::Agent::Agent</a>
<li><a href="./NewRelic/Agent/Agent/ClassMethods.html">NewRelic::Agent::Agent::ClassMethods</a>
<li><a href="./NewRelic/Agent/Agent/InstanceMethods.html">NewRelic::Agent::Agent::InstanceMethods</a>
<li><a href="./NewRelic/Agent/Agent/InstanceMethods/Connect.html">NewRelic::Agent::Agent::InstanceMethods::Connect</a>
<li><a href="./NewRelic/Agent/Agent/InstanceMethods/Start.html">NewRelic::Agent::Agent::InstanceMethods::Start</a>
<li><a href="./NewRelic/Agent/Agent/InstanceMethods/StartWorkerThread.html">NewRelic::Agent::Agent::InstanceMethods::StartWorkerThread</a>
<li><a href="./NewRelic/Agent/BackgroundLoadingError.html">NewRelic::Agent::BackgroundLoadingError</a>
<li><a href="./NewRelic/Agent/BeaconConfiguration.html">NewRelic::Agent::BeaconConfiguration</a>
<li><a href="./NewRelic/Agent/BrowserMonitoring.html">NewRelic::Agent::BrowserMonitoring</a>
<li><a href="./NewRelic/Agent/BrowserMonitoring/DummyMetricFrame.html">NewRelic::Agent::BrowserMonitoring::DummyMetricFrame</a>
<li><a href="./NewRelic/Agent/BusyCalculator.html">NewRelic::Agent::BusyCalculator</a>
<li><a href="./NewRelic/Agent/Database.html">NewRelic::Agent::Database</a>
<li><a href="./NewRelic/Agent/Database/ConnectionManager.html">NewRelic::Agent::Database::ConnectionManager</a>
<li><a href="./NewRelic/Agent/Database/Obfuscator.html">NewRelic::Agent::Database::Obfuscator</a>
<li><a href="./NewRelic/Agent/ErrorCollector.html">NewRelic::Agent::ErrorCollector</a>
<li><a href="./NewRelic/Agent/ErrorCollector/NoticeError.html">NewRelic::Agent::ErrorCollector::NoticeError</a>
<li><a href="./NewRelic/Agent/ForceDisconnectException.html">NewRelic::Agent::ForceDisconnectException</a>
<li><a href="./NewRelic/Agent/ForceRestartException.html">NewRelic::Agent::ForceRestartException</a>
<li><a href="./NewRelic/Agent/Instrumentation.html">NewRelic::Agent::Instrumentation</a>
<li><a href="./NewRelic/Agent/Instrumentation/ActiveRecordInstrumentation.html">NewRelic::Agent::Instrumentation::ActiveRecordInstrumentation</a>
<li><a href="./NewRelic/Agent/Instrumentation/ControllerInstrumentation.html">NewRelic::Agent::Instrumentation::ControllerInstrumentation</a>
<li><a href="./NewRelic/Agent/Instrumentation/ControllerInstrumentation/ClassMethods.html">NewRelic::Agent::Instrumentation::ControllerInstrumentation::ClassMethods</a>
<li><a href="./NewRelic/Agent/Instrumentation/DataMapperInstrumentation.html">NewRelic::Agent::Instrumentation::DataMapperInstrumentation</a>
<li><a href="./NewRelic/Agent/Instrumentation/Memcache.html">NewRelic::Agent::Instrumentation::Memcache</a>
<li><a href="./NewRelic/Agent/Instrumentation/MetricFrame.html">NewRelic::Agent::Instrumentation::MetricFrame</a>
<li><a href="./NewRelic/Agent/Instrumentation/MetricFrame/Pop.html">NewRelic::Agent::Instrumentation::MetricFrame::Pop</a>
<li><a href="./NewRelic/Agent/Instrumentation/QueueTime.html">NewRelic::Agent::Instrumentation::QueueTime</a>
<li><a href="./NewRelic/Agent/Instrumentation/Rack.html">NewRelic::Agent::Instrumentation::Rack</a>
<li><a href="./NewRelic/Agent/Instrumentation/Rails3.html">NewRelic::Agent::Instrumentation::Rails3</a>
<li><a href="./NewRelic/Agent/Instrumentation/Rails3/ActionController.html">NewRelic::Agent::Instrumentation::Rails3::ActionController</a>
<li><a href="./NewRelic/Agent/Instrumentation/Rails3/ActionView.html">NewRelic::Agent::Instrumentation::Rails3::ActionView</a>
<li><a href="./NewRelic/Agent/Instrumentation/Rails3/ActionView/PartialRenderer.html">NewRelic::Agent::Instrumentation::Rails3::ActionView::PartialRenderer</a>
<li><a href="./NewRelic/Agent/Instrumentation/Rails3/Errors.html">NewRelic::Agent::Instrumentation::Rails3::Errors</a>
<li><a href="./NewRelic/Agent/Instrumentation/Sinatra.html">NewRelic::Agent::Instrumentation::Sinatra</a>
<li><a href="./NewRelic/Agent/LicenseException.html">NewRelic::Agent::LicenseException</a>
<li><a href="./NewRelic/Agent/MethodTracer.html">NewRelic::Agent::MethodTracer</a>
<li><a href="./NewRelic/Agent/MethodTracer/ClassMethods.html">NewRelic::Agent::MethodTracer::ClassMethods</a>
<li><a href="./NewRelic/Agent/MethodTracer/ClassMethods/AddMethodTracer.html">NewRelic::Agent::MethodTracer::ClassMethods::AddMethodTracer</a>
<li><a href="./NewRelic/Agent/MethodTracer/InstanceMethods.html">NewRelic::Agent::MethodTracer::InstanceMethods</a>
<li><a href="./NewRelic/Agent/MethodTracer/InstanceMethods/TraceExecutionScoped.html">NewRelic::Agent::MethodTracer::InstanceMethods::TraceExecutionScoped</a>
<li><a href="./NewRelic/Agent/PostTooBigException.html">NewRelic::Agent::PostTooBigException</a>
<li><a href="./NewRelic/Agent/Sampler.html">NewRelic::Agent::Sampler</a>
<li><a href="./NewRelic/Agent/Sampler/Unsupported.html">NewRelic::Agent::Sampler::Unsupported</a>
<li><a href="./NewRelic/Agent/Samplers.html">NewRelic::Agent::Samplers</a>
<li><a href="./NewRelic/Agent/Samplers/CpuSampler.html">NewRelic::Agent::Samplers::CpuSampler</a>
<li><a href="./NewRelic/Agent/Samplers/DelayedJobLockSampler.html">NewRelic::Agent::Samplers::DelayedJobLockSampler</a>
<li><a href="./NewRelic/Agent/Samplers/MemorySampler.html">NewRelic::Agent::Samplers::MemorySampler</a>
<li><a href="./NewRelic/Agent/Samplers/MemorySampler/Base.html">NewRelic::Agent::Samplers::MemorySampler::Base</a>
<li><a href="./NewRelic/Agent/Samplers/MemorySampler/JavaHeapSampler.html">NewRelic::Agent::Samplers::MemorySampler::JavaHeapSampler</a>
<li><a href="./NewRelic/Agent/Samplers/MemorySampler/ProcStatus.html">NewRelic::Agent::Samplers::MemorySampler::ProcStatus</a>
<li><a href="./NewRelic/Agent/Samplers/MemorySampler/ShellPS.html">NewRelic::Agent::Samplers::MemorySampler::ShellPS</a>
<li><a href="./NewRelic/Agent/Samplers/ObjectSampler.html">NewRelic::Agent::Samplers::ObjectSampler</a>
<li><a href="./NewRelic/Agent/ServerConnectionException.html">NewRelic::Agent::ServerConnectionException</a>
<li><a href="./NewRelic/Agent/ServerError.html">NewRelic::Agent::ServerError</a>
<li><a href="./NewRelic/Agent/ShimAgent.html">NewRelic::Agent::ShimAgent</a>
<li><a href="./NewRelic/Agent/SlowSql.html">NewRelic::Agent::SlowSql</a>
<li><a href="./NewRelic/Agent/SqlSampler.html">NewRelic::Agent::SqlSampler</a>
<li><a href="./NewRelic/Agent/SqlTrace.html">NewRelic::Agent::SqlTrace</a>
<li><a href="./NewRelic/Agent/StatsEngine.html">NewRelic::Agent::StatsEngine</a>
<li><a href="./NewRelic/Agent/StatsEngine/GCProfiler.html">NewRelic::Agent::StatsEngine::GCProfiler</a>
<li><a href="./NewRelic/Agent/StatsEngine/GCProfiler/Profiler.html">NewRelic::Agent::StatsEngine::GCProfiler::Profiler</a>
<li><a href="./NewRelic/Agent/StatsEngine/GCProfiler/RailsBench.html">NewRelic::Agent::StatsEngine::GCProfiler::RailsBench</a>
<li><a href="./NewRelic/Agent/StatsEngine/GCProfiler/Rubinius.html">NewRelic::Agent::StatsEngine::GCProfiler::Rubinius</a>
<li><a href="./NewRelic/Agent/StatsEngine/GCProfiler/Ruby19.html">NewRelic::Agent::StatsEngine::GCProfiler::Ruby19</a>
<li><a href="./NewRelic/Agent/StatsEngine/MetricStats.html">NewRelic::Agent::StatsEngine::MetricStats</a>
<li><a href="./NewRelic/Agent/StatsEngine/MetricStats/Harvest.html">NewRelic::Agent::StatsEngine::MetricStats::Harvest</a>
<li><a href="./NewRelic/Agent/StatsEngine/MetricStats/SynchronizedHash.html">NewRelic::Agent::StatsEngine::MetricStats::SynchronizedHash</a>
<li><a href="./NewRelic/Agent/StatsEngine/Samplers.html">NewRelic::Agent::StatsEngine::Samplers</a>
<li><a href="./NewRelic/Agent/StatsEngine/ScopeStackElement.html">NewRelic::Agent::StatsEngine::ScopeStackElement</a>
<li><a href="./NewRelic/Agent/StatsEngine/Transactions.html">NewRelic::Agent::StatsEngine::Transactions</a>
<li><a href="./NewRelic/Agent/TransactionInfo.html">NewRelic::Agent::TransactionInfo</a>
<li><a href="./NewRelic/Agent/TransactionSampleBuilder.html">NewRelic::Agent::TransactionSampleBuilder</a>
<li><a href="./NewRelic/Agent/TransactionSampler.html">NewRelic::Agent::TransactionSampler</a>
<li><a href="./NewRelic/Agent/TransactionSqlData.html">NewRelic::Agent::TransactionSqlData</a>
<li><a href="./NewRelic/Agent/WorkerLoop.html">NewRelic::Agent::WorkerLoop</a>
<li><a href="./NewRelic/ApdexStats.html">NewRelic::ApdexStats</a>
<li><a href="./NewRelic/BasicStats.html">NewRelic::BasicStats</a>
<li><a href="./NewRelic/ChainedCall.html">NewRelic::ChainedCall</a>
<li><a href="./NewRelic/CollectionHelper.html">NewRelic::CollectionHelper</a>
<li><a href="./NewRelic/Command.html">NewRelic::Command</a>
<li><a href="./NewRelic/Command/CommandFailure.html">NewRelic::Command::CommandFailure</a>
<li><a href="./NewRelic/Command/Deployments.html">NewRelic::Command::Deployments</a>
<li><a href="./NewRelic/Command/Install.html">NewRelic::Command::Install</a>
<li><a href="./NewRelic/Control.html">NewRelic::Control</a>
<li><a href="./NewRelic/Control/ClassMethods.html">NewRelic::Control::ClassMethods</a>
<li><a href="./NewRelic/Control/Configuration.html">NewRelic::Control::Configuration</a>
<li><a href="./NewRelic/Control/Frameworks.html">NewRelic::Control::Frameworks</a>
<li><a href="./NewRelic/Control/Frameworks/External.html">NewRelic::Control::Frameworks::External</a>
<li><a href="./NewRelic/Control/Frameworks/Merb.html">NewRelic::Control::Frameworks::Merb</a>
<li><a href="./NewRelic/Control/Frameworks/Rails.html">NewRelic::Control::Frameworks::Rails</a>
<li><a href="./NewRelic/Control/Frameworks/Rails3.html">NewRelic::Control::Frameworks::Rails3</a>
<li><a href="./NewRelic/Control/Frameworks/Ruby.html">NewRelic::Control::Frameworks::Ruby</a>
<li><a href="./NewRelic/Control/Frameworks/Sinatra.html">NewRelic::Control::Frameworks::Sinatra</a>
<li><a href="./NewRelic/Control/InstanceMethods.html">NewRelic::Control::InstanceMethods</a>
<li><a href="./NewRelic/Control/Instrumentation.html">NewRelic::Control::Instrumentation</a>
<li><a href="./NewRelic/Control/LoggingMethods.html">NewRelic::Control::LoggingMethods</a>
<li><a href="./NewRelic/Control/Profiling.html">NewRelic::Control::Profiling</a>
<li><a href="./NewRelic/Control/ServerMethods.html">NewRelic::Control::ServerMethods</a>
<li><a href="./NewRelic/DataSerialization.html">NewRelic::DataSerialization</a>
<li><a href="./NewRelic/DataSerialization/ClassMethods.html">NewRelic::DataSerialization::ClassMethods</a>
<li><a href="./NewRelic/DelayedJobInjection.html">NewRelic::DelayedJobInjection</a>
<li><a href="./NewRelic/Instrumentation.html">NewRelic::Instrumentation</a>
<li><a href="./NewRelic/Instrumentation/ActsAsSolrInstrumentation.html">NewRelic::Instrumentation::ActsAsSolrInstrumentation</a>
<li><a href="./NewRelic/Instrumentation/ActsAsSolrInstrumentation/ParserMethodsInstrumentation.html">NewRelic::Instrumentation::ActsAsSolrInstrumentation::ParserMethodsInstrumentation</a>
<li><a href="./NewRelic/LanguageSupport.html">NewRelic::LanguageSupport</a>
<li><a href="./NewRelic/LanguageSupport/Control.html">NewRelic::LanguageSupport::Control</a>
<li><a href="./NewRelic/LanguageSupport/DataSerialization.html">NewRelic::LanguageSupport::DataSerialization</a>
<li><a href="./NewRelic/LanguageSupport/SynchronizedHash.html">NewRelic::LanguageSupport::SynchronizedHash</a>
<li><a href="./NewRelic/LocalEnvironment.html">NewRelic::LocalEnvironment</a>
<li><a href="./NewRelic/MerbBootLoader.html">NewRelic::MerbBootLoader</a>
<li><a href="./NewRelic/MethodTraceStats.html">NewRelic::MethodTraceStats</a>
<li><a href="./NewRelic/MetricData.html">NewRelic::MetricData</a>
<li><a href="./NewRelic/MetricSpec.html">NewRelic::MetricSpec</a>
<li><a href="./NewRelic/Metrics.html">NewRelic::Metrics</a>
<li><a href="./NewRelic/NoticedError.html">NewRelic::NoticedError</a>
<li><a href="./NewRelic/Rack.html">NewRelic::Rack</a>
<li><a href="./NewRelic/Rack/BrowserMonitoring.html">NewRelic::Rack::BrowserMonitoring</a>
<li><a href="./NewRelic/Rack/DeveloperMode.html">NewRelic::Rack::DeveloperMode</a>
<li><a href="./NewRelic/Railtie.html">NewRelic::Railtie</a>
<li><a href="./NewRelic/ScopedMethodTraceStats.html">NewRelic::ScopedMethodTraceStats</a>
<li><a href="./NewRelic/Stats.html">NewRelic::Stats</a>
<li><a href="./NewRelic/StatsBase.html">NewRelic::StatsBase</a>
<li><a href="./NewRelic/TransactionAnalysis.html">NewRelic::TransactionAnalysis</a>
<li><a href="./NewRelic/TransactionAnalysis/SegmentSummary.html">NewRelic::TransactionAnalysis::SegmentSummary</a>
<li><a href="./NewRelic/TransactionSample.html">NewRelic::TransactionSample</a>
<li><a href="./NewRelic/TransactionSample/CompositeSegment.html">NewRelic::TransactionSample::CompositeSegment</a>
<li><a href="./NewRelic/TransactionSample/FakeSegment.html">NewRelic::TransactionSample::FakeSegment</a>
<li><a href="./NewRelic/TransactionSample/Segment.html">NewRelic::TransactionSample::Segment</a>
<li><a href="./NewRelic/TransactionSample/SummarySegment.html">NewRelic::TransactionSample::SummarySegment</a>
<li><a href="./NewRelic/UrlRule.html">NewRelic::UrlRule</a>
<li><a href="./NewRelic/UrlRule/RuleSet.html">NewRelic::UrlRule::RuleSet</a>
<li><a href="./NewRelic/VersionNumber.html">NewRelic::VersionNumber</a>
<li><a href="./ActionView.html">ActionView</a>
<li><a href="./ActionView/Base.html">ActionView::Base</a>
<li><a href="./ActionView/Partials.html">ActionView::Partials</a>
<li><a href="./ActionView/Partials/PartialRenderer.html">ActionView::Partials::PartialRenderer</a>
<li><a href="./ActionController.html">ActionController</a>
<li><a href="./ActionController/Base.html">ActionController::Base</a>
<li><a href="./Object.html">Object</a>
</ul>
</nav>
</div>
</nav>
<div id="documentation" class="description">
<h1 id="label-New+Relic+Ruby+Agent">New Relic Ruby Agent</h1>
<p>New Relic is a performance management system, developed by New Relic, Inc
(<a href="http://www.newrelic.com">www.newrelic.com</a>). It provides you
with deep information about the performance of your Rails or Ruby
application as it runs in production. The New Relic Ruby Agent is
dual-purposed as a either a Rails plugin or a Gem, hosted on <a
href="http://github.com/newrelic/rpm/tree/master">github</a>.</p>
<p>The New Relic Ruby Agent runs in one of two modes:</p>
<h4 id="label-Production+Mode">Production Mode</h4>
<p>Low overhead instrumentation that captures detailed information on your
application running in production and transmits them to newrelic.com where
you can monitor them in real time.</p>
<h4 id="label-Developer+Mode">Developer Mode</h4>
<p>A Rack middleware that maps /newrelic to an application for showing
detailed performance metrics on a page by page basis. Installed
automatically in Rails applications.</p>
<h2 id="label-Supported+Environments">Supported Environments</h2>
<ul><li>
<p>Ruby 1.8.7, 1.9.1, or 1.9.2, including REE</p>
</li><li>
<p>JRuby 1.4 or higher</p>
</li><li>
<p>Rails 2.0 or later for Production Mode</p>
</li><li>
<p>Rails 2.3 or later for Developer Mode</p>
</li><li>
<p>Sinatra</p>
</li><li>
<p>Rack</p>
</li></ul>
<p>Any Rack based framework should work but may not be tested. Install the
Ruby Agent as a gem and add the Developer Mode middleware if desired.
Report any problems to support@newrelic.com.</p>
<p>You can also monitor non-web applications. Refer to the “Other
Environments” section under “Getting Started”.</p>
<h1 id="label-Getting+Started">Getting Started</h1>
<p>Install the Ruby Agent as a gem. If you are using Rails you can install
the gem as a plug-in–details below.</p>
<pre>gem install newrelic_rpm</pre>
<p>To monitor your applications in production, create an account at <a
href="http://newrelic.com/">newrelic.com/</a> . There you can sign up for
a free Lite account or one of our paid subscriptions.</p>
<p>Once you receive the welcome e-mail with a license key and
<code>newrelic.yml</code> file, copy the <code>newrelic.yml</code> file
into your app config directory.</p>
<p>All agent configuration is done in the <code>newrelic.yml</code> file.
This file is by default read from the <code>config</code> directory of the
application root and is subsequently searched for in the application root
directory, and then in a <code>~/.newrelic</code> directory</p>
<h3 id="label-Rails+Installation">Rails Installation</h3>
<p>You can install the agent as a Gem:</p>
<p>For Bundler:</p>
<p>Add the following line to your Gemfile:</p>
<pre>gem 'newrelic_rpm'</pre>
<p>For Rails 2.x without Bundler:</p>
<p>edit <code>environment.rb</code> and add to the initalizer block:</p>
<pre>config.gem "newrelic_rpm"</pre>
<h3 id="label-Merb+Installation">Merb Installation</h3>
<p>To monitor a merb app install the newrelic_rpm gem and add</p>
<pre>dependency 'newrelic_rpm'</pre>
<p>to your init.rb file.</p>
<h3 id="label-Sinatra+Installation+">Sinatra Installation </h3>
<p>To use the Ruby Agent with a Sinatra app, add</p>
<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">'newrelic_rpm'</span>
</pre>
<p>in your Sinatra app, below the Sinatra require directive.</p>
<p>Then make sure you set RACK_ENV to the environment corresponding to the
configuration definitions in the newrelic.yml file; i.e., development,
staging, production, etc.</p>
<p>To use Developer Mode in Sinatra, add <a
href="NewRelic/Rack/DeveloperMode.html">NewRelic::Rack::DeveloperMode</a>
to the middleware stack. See the <code>config.ru</code> sample below.</p>
<h3 id="label-Other+Environments">Other Environments</h3>
<p>You can use the Ruby Agent to monitor any Ruby application. Add</p>
<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">'newrelic_rpm'</span>
</pre>
<p>to your startup sequence and then manually start the agent using</p>
<pre>NewRelic::Agent.manual_start</pre>
<p>To instrument Rack based applications, refer to the docs in <a
href="NewRelic/Agent/Instrumentation/Rack.html">NewRelic::Agent::Instrumentation::Rack</a>.</p>
<p>Refer to the docs in New Relic for details on how to monitor other web
frameworks, background jobs, and daemons.</p>
<p>Also, see if your environment is already supported by the <a
href="http://newrelic.github.com/rpm_contrib">rpm_contrib</a> gem.</p>
<h2 id="label-Developer+Mode">Developer Mode</h2>
<p>When running the Developer Mode, the Ruby Agent will track the performance
of every HTTP request serviced by your application, and store in memory
this information for the last 100 HTTP transactions.</p>
<p>To view this performance information, including detailed SQL statement
analysis, open <code>/newrelic</code> in your web application. For
instance if you are running mongrel or thin on port 3000, enter the
following into your browser:</p>
<pre>http://localhost:3000/newrelic</pre>
<p>Developer Mode is only initialized if the <code>developer_mode</code>
setting in the newrelic.yml file is set to true. By default, it is turned
off in all environments but <code>development</code>.</p>
<h4 id="label-Developer+Mode+in+Rails">Developer Mode in Rails</h4>
<p>Developer Mode is available automatically in Rails Applications based on
Rails 2.3 and later. No additional configuration is required. When your
application starts and <code>developer_mode</code> is enabled, the Ruby
Agent injects a middleware into your Rails middleware stack.</p>
<p>For earlier versions of Rails that support Rack, you can use a
<code>config.ru</code> as below.</p>
<h4 id="label-Developer+Mode+in+Rack+Applications">Developer Mode in Rack Applications</h4>
<p>Developer Mode is available for any Rack based application such as Sinatra
by installing the <a
href="NewRelic/Rack/DeveloperMode.html">NewRelic::Rack::DeveloperMode</a>
middleware. This middleware passes all requests that do not start with
/newrelic.</p>
<p>Here’s an example entry for Developer Mode in a <code>config.ru</code>
file:</p>
<pre class="ruby"><span class="ruby-identifier">require</span> <span class="ruby-string">'new_relic/rack/developer_mode'</span>
<span class="ruby-identifier">use</span> <span class="ruby-constant">NewRelic</span><span class="ruby-operator">::</span><span class="ruby-constant">Rack</span><span class="ruby-operator">::</span><span class="ruby-constant">DeveloperMode</span>
</pre>
<h2 id="label-Production+Mode">Production Mode</h2>
<p>When your application runs in the production environment, the New Relic
agent runs in production mode. It connects to the New Relic service and
sends deep performance data to the UI for your analysis. To view this data,
log in to <a href="http://rpm.newrelic.com.">rpm.newrelic.com.</a></p>
<p>NOTE: You must have a valid account and license key to view this data
online. Refer to instructions in *Getting Started*, below.</p>
<h1 id="label-Support">Support</h1>
<p>Reach out to us–and to fellow users–at <a
href="http://support.newrelic.com/">support.newrelic.com</a>. There
you’ll find documentation, FAQs, and forums where you can submit
suggestions and discuss New Relic with staff and other users.</p>
<p>Also available is community support on IRC: we generally use newrelic on
irc.freenode.net</p>
<p>Find a bug? E-mail support@newrelic.com, or post it to <a
href="http://support.newrelic.com/">support.newrelic.com</a>.</p>
<p>Thank you, and may your application scale to infinity plus one.</p>
<p>Lew Cirne, Founder and CEO<br/> New Relic, Inc.</p>
</div>
<footer id="validator-badges">
<p><a href="http://validator.w3.org/check/referer">[Validate]</a>
<p>Generated by <a href="https://github.com/rdoc/rdoc">RDoc</a> 3.11.
<p>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish Rdoc Generator</a> 3.
</footer>