newrelic_rpm 2.8.4 → 2.8.5
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of newrelic_rpm might be problematic. Click here for more details.
- data/README +88 -45
- data/lib/new_relic/agent/agent.rb +2 -2
- data/lib/new_relic/agent/instrumentation/active_merchant.rb +18 -0
- data/lib/new_relic/agent/instrumentation/active_record_instrumentation.rb +1 -1
- data/lib/new_relic/agent/instrumentation/merb/controller.rb +2 -2
- data/lib/new_relic/agent/stats_engine.rb +0 -1
- data/lib/new_relic/agent/transaction_sampler.rb +7 -14
- data/lib/new_relic/config.rb +7 -7
- data/lib/new_relic/recipes.rb +1 -1
- data/lib/new_relic/version.rb +9 -2
- data/lib/new_relic_api.rb +5 -0
- data/lib/tasks/agent_tests.rake +4 -1
- data/test/new_relic/agent/tc_transaction_sampler.rb +1 -4
- data/ui/helpers/newrelic_helper.rb +1 -1
- metadata +3 -2
data/README
CHANGED
@@ -2,67 +2,83 @@
|
|
2
2
|
|
3
3
|
* http://www.newrelic.com
|
4
4
|
|
5
|
-
New Relic RPM is a Ruby performance management system, developed by
|
6
|
-
RPM provides you with deep information about the
|
7
|
-
or Merb application as it runs in
|
8
|
-
|
5
|
+
New Relic RPM is a Ruby performance management system, developed by
|
6
|
+
New Relic, Inc. RPM provides you with deep information about the
|
7
|
+
performance of your Ruby on Rails or Merb application as it runs in
|
8
|
+
production. The New Relic Agent is distributed as a either a Rails
|
9
|
+
plugin or a Gem, both hosted on RubyForge.
|
9
10
|
|
10
11
|
The New Relic Agent runs in one of two modes:
|
11
12
|
|
12
|
-
* Developer Mode : Adds a web interface mapped to /newrelic to your
|
13
|
-
showing detailed performance metrics on a page by
|
13
|
+
* Developer Mode : Adds a web interface mapped to /newrelic to your
|
14
|
+
application for showing detailed performance metrics on a page by
|
15
|
+
page basis.
|
14
16
|
|
15
|
-
* Production Mode : Low overhead instrumentation that captures
|
16
|
-
on your application running in production and
|
17
|
-
where you can monitor them in
|
17
|
+
* Production Mode : Low overhead instrumentation that captures
|
18
|
+
detailed information on your application running in production and
|
19
|
+
transmits them to rpm.newrelic.com where you can monitor them in
|
20
|
+
real time.
|
18
21
|
|
19
|
-
===
|
22
|
+
=== Developer Mode
|
20
23
|
|
21
|
-
Developer mode is on by default when you run your application in the
|
22
|
-
environment (but not when it runs in other environments.)
|
23
|
-
developer mode, RPM will track the performance of
|
24
|
-
by your application, and store in memory
|
25
|
-
transactions.
|
24
|
+
Developer mode is on by default when you run your application in the
|
25
|
+
development environment (but not when it runs in other environments.)
|
26
|
+
When running in developer mode, RPM will track the performance of
|
27
|
+
every http request serviced by your application, and store in memory
|
28
|
+
this information for the last 100 http transactions.
|
26
29
|
|
27
|
-
When running in Developer Mode, the RPM will also add a few pages to
|
28
|
-
your application that allow you to analyze this performance
|
29
|
-
worry - those pages are not added to your
|
30
|
-
production mode.)
|
30
|
+
When running in Developer Mode, the RPM will also add a few pages to
|
31
|
+
your application that allow you to analyze this performance
|
32
|
+
information. (Don't worry - those pages are not added to your
|
33
|
+
application's routes when you run in production mode.)
|
31
34
|
|
32
|
-
To view this performance information, including detailed SQL statement
|
33
|
-
open '/newrelic' in your web application. For instance if
|
34
|
-
mongrel or thin on port 3000, enter the following into
|
35
|
+
To view this performance information, including detailed SQL statement
|
36
|
+
analysis, open '/newrelic' in your web application. For instance if
|
37
|
+
you are running mongrel or thin on port 3000, enter the following into
|
38
|
+
your browser:
|
35
39
|
|
36
40
|
http://localhost:3000/newrelic
|
37
41
|
|
38
|
-
===
|
42
|
+
=== Production Mode
|
39
43
|
|
40
44
|
To monitor your applications in production, create an account at
|
41
45
|
http://newrelic.com/get-RPM.html
|
42
46
|
|
43
|
-
When your application runs in the production environment, the New
|
44
|
-
runs in production mode. It connects to the New Relic RPM
|
45
|
-
performance data to the RPM service for your
|
46
|
-
to http://rpm.newrelic.com.
|
47
|
+
When your application runs in the production environment, the New
|
48
|
+
Relic agent runs in production mode. It connects to the New Relic RPM
|
49
|
+
service and sends deep performance data to the RPM service for your
|
50
|
+
analysis. To view this data, login to http://rpm.newrelic.com.
|
47
51
|
|
48
|
-
NOTE: You must have a valid account and license key to view this data
|
49
|
-
When you sign up for an account at www.newrelic.com, you will
|
50
|
-
license key, as well as a default configuration
|
51
|
-
either paste your license key into
|
52
|
-
config/newrelic.yml, or you can
|
53
|
-
your welcome email.
|
52
|
+
NOTE: You must have a valid account and license key to view this data
|
53
|
+
online. When you sign up for an account at www.newrelic.com, you will
|
54
|
+
be provided with a license key, as well as a default configuration
|
55
|
+
file for New Relic RPM. You can either paste your license key into
|
56
|
+
your existing configuration file, config/newrelic.yml, or you can
|
57
|
+
replace that config file with the one included in your welcome email.
|
54
58
|
|
55
|
-
==
|
59
|
+
== Installation
|
60
|
+
|
61
|
+
RPM requires an agent be installed in the application as either a
|
62
|
+
Rails plug-in or a gem. Both are available on RubyForge--instructions
|
63
|
+
below.
|
64
|
+
|
65
|
+
=== Git your RPM on!
|
66
|
+
|
67
|
+
The agent is also available on Github under newrelic/rpm. As of March,
|
68
|
+
2009, we keep the latest release on the master, the edge on a working
|
69
|
+
branch, and previous releases with tags. Fork away!
|
70
|
+
|
71
|
+
=== Requirements:
|
56
72
|
|
57
73
|
Ruby 1.8.6
|
58
74
|
Rails 1.2.6 or above
|
59
75
|
Merb 1.0 or above
|
60
76
|
|
61
|
-
|
77
|
+
=== Rails Plug-In Installation
|
62
78
|
|
63
79
|
script/plugin install http://newrelic.rubyforge.net/svn/newrelic_rpm
|
64
80
|
|
65
|
-
|
81
|
+
=== Gem Installation
|
66
82
|
|
67
83
|
sudo gem install newrelic_rpm
|
68
84
|
|
@@ -70,20 +86,47 @@ For Rails, edit environment.rb and add to the initalizer block:
|
|
70
86
|
|
71
87
|
config.gem "newrelic_rpm"
|
72
88
|
|
73
|
-
The Developer Mode is unavailable when using the gem on Rails versions
|
89
|
+
The Developer Mode is unavailable when using the gem on Rails versions
|
90
|
+
prior to 2.0.
|
74
91
|
|
75
|
-
==
|
92
|
+
== Merb Support
|
93
|
+
|
94
|
+
To monitor a merb app install the newrelic_rpm gem and add
|
95
|
+
|
96
|
+
dependency 'newrelic_rpm'
|
76
97
|
|
77
|
-
To monitor a merb app install the newrelic_rpm gem and add <code>dependency 'newrelic_rpm'</code>
|
78
98
|
to your init.rb file.
|
79
99
|
|
80
|
-
|
81
|
-
|
82
|
-
|
100
|
+
Current features implemented:
|
101
|
+
|
102
|
+
* Standard monitoring, overview pages
|
103
|
+
* Error capturing
|
104
|
+
* Full Active Record instrumentation, including SQL explains
|
105
|
+
* Very limited Data Mapper instrumentation
|
106
|
+
* Transaction Traces are implemented but will not be very useful
|
107
|
+
with Data Mapper until more work is done with the Data Mapper
|
108
|
+
instrumentation
|
109
|
+
|
110
|
+
Still under development:
|
111
|
+
|
112
|
+
* Developer Mode
|
113
|
+
* Data Mapper bindings
|
114
|
+
|
115
|
+
Also some of the instrumentation has been implemented with method
|
116
|
+
chaining, a mechanism that truly goes against the merb way. This was
|
117
|
+
necessary in some cases where the API’s were not yet available or
|
118
|
+
understood well enough to use. Converting these to hook methods using
|
119
|
+
the Merb public API is a work in progress.
|
120
|
+
|
121
|
+
== Support
|
122
|
+
|
123
|
+
Reach out to us--and to fellow RPM users--at
|
124
|
+
http://support.newrelic.com. There you'll find documentation, FAQs,
|
125
|
+
and forums where you can submit suggestions and discuss RPM with New
|
126
|
+
Relic staff and other users.
|
83
127
|
|
84
|
-
|
85
|
-
|
86
|
-
questions, and announce product updates. Operators are standing by.
|
128
|
+
Find a bug? E-mail support@newrelic.com, or post it to
|
129
|
+
support.newrelic.com.
|
87
130
|
|
88
131
|
For other support channels, see http://www.newrelic.com/support.
|
89
132
|
|
@@ -304,7 +304,7 @@ module NewRelic::Agent
|
|
304
304
|
end
|
305
305
|
|
306
306
|
def apdex_t
|
307
|
-
@apdex_t ||=
|
307
|
+
@apdex_t ||= config['apdex_t'].to_f
|
308
308
|
end
|
309
309
|
|
310
310
|
private
|
@@ -466,7 +466,7 @@ module NewRelic::Agent
|
|
466
466
|
@transaction_sampler = NewRelic::Agent::TransactionSampler.new(self)
|
467
467
|
@error_collector = NewRelic::Agent::ErrorCollector.new(self)
|
468
468
|
|
469
|
-
@request_timeout =
|
469
|
+
@request_timeout = NewRelic::Config.instance.fetch('timeout', 2 * 60)
|
470
470
|
|
471
471
|
@invalid_license = false
|
472
472
|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# ActiveMerchant Instrumentation.
|
2
|
+
|
3
|
+
if defined? ActiveMerchant
|
4
|
+
|
5
|
+
ActiveMerchant::Billing::Gateway.implementations.each do |gateway|
|
6
|
+
gateway.class_eval do
|
7
|
+
implemented_methods = public_instance_methods(false)
|
8
|
+
gateway_name = self.name.split('::').last
|
9
|
+
[:authorize, :purchase, :credit, :void, :capture, :recurring].each do |operation|
|
10
|
+
if implemented_methods.include?(operation.to_s)
|
11
|
+
add_method_tracer operation, "ActiveMerchant/gateway/#{gateway_name}/#{operation}", :scoped_metric_only => true
|
12
|
+
add_method_tracer operation, "ActiveMerchant/gateway/#{gateway_name}", :push_scope => false
|
13
|
+
add_method_tracer operation, "ActiveMerchant/operation/#{operation}", :push_scope => false
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'set'
|
2
|
-
require 'merb-core/controller/
|
2
|
+
require 'merb-core/controller/merb_controller'
|
3
3
|
|
4
|
-
Merb::
|
4
|
+
Merb::Controller.class_eval do
|
5
5
|
include NewRelic::Agent::Instrumentation::ControllerInstrumentation
|
6
6
|
|
7
7
|
class_inheritable_accessor :newrelic_ignore_attr
|
@@ -1,7 +1,6 @@
|
|
1
1
|
|
2
2
|
module NewRelic::Agent
|
3
3
|
|
4
|
-
|
5
4
|
class TransactionSampler
|
6
5
|
include Synchronize
|
7
6
|
|
@@ -34,23 +33,17 @@ module NewRelic::Agent
|
|
34
33
|
|
35
34
|
|
36
35
|
def default_sql_obfuscator(sql)
|
37
|
-
|
38
|
-
|
39
|
-
# remove
|
40
|
-
sql
|
41
|
-
|
42
|
-
|
43
|
-
sql = sql.gsub(/'[^']*'/, "?")
|
44
|
-
|
36
|
+
sql = sql.dup
|
37
|
+
# This is hardly readable. Use the unit tests.
|
38
|
+
# remove single quoted strings:
|
39
|
+
sql.gsub!(/'(.*?[^\\'])??'(?!')/, '?')
|
40
|
+
# remove double quoted strings:
|
41
|
+
sql.gsub!(/"(.*?[^\\"])??"(?!")/, '?')
|
45
42
|
# replace all number literals
|
46
|
-
sql
|
47
|
-
|
48
|
-
# puts "result: #{sql}"
|
49
|
-
|
43
|
+
sql.gsub!(/\d+/, "?")
|
50
44
|
sql
|
51
45
|
end
|
52
46
|
|
53
|
-
|
54
47
|
def notice_first_scope_push(time)
|
55
48
|
if Thread::current[:record_tt] == false
|
56
49
|
Thread::current[BUILDER_KEY] = nil
|
data/lib/new_relic/config.rb
CHANGED
@@ -3,6 +3,7 @@ require 'new_relic/local_environment'
|
|
3
3
|
require 'singleton'
|
4
4
|
require 'erb'
|
5
5
|
require 'net/https'
|
6
|
+
require 'logger'
|
6
7
|
|
7
8
|
# Configuration supports the behavior of the agent which is dependent
|
8
9
|
# on what environment is being monitored: rails, merb, ruby, etc
|
@@ -12,7 +13,7 @@ module NewRelic
|
|
12
13
|
|
13
14
|
class Config
|
14
15
|
|
15
|
-
attr_accessor :log_file
|
16
|
+
attr_accessor :log_file, :env
|
16
17
|
|
17
18
|
# Structs holding info for the remote server and proxy server
|
18
19
|
class Server < Struct.new :host, :port
|
@@ -50,13 +51,12 @@ module NewRelic
|
|
50
51
|
fetch(key)
|
51
52
|
end
|
52
53
|
####################################
|
53
|
-
def env=(env_name)
|
54
|
-
@env = env_name
|
55
|
-
@settings = @yaml[env_name]
|
56
|
-
end
|
57
|
-
|
58
54
|
def settings
|
59
|
-
@settings
|
55
|
+
if @settings.nil?
|
56
|
+
@settings = (@yaml && @yaml[env]) || {}
|
57
|
+
@settings['apdex_t'] ||= 1.0
|
58
|
+
end
|
59
|
+
@settings
|
60
60
|
end
|
61
61
|
|
62
62
|
def []=(key, value)
|
data/lib/new_relic/recipes.rb
CHANGED
@@ -52,7 +52,7 @@ make_notify_task = lambda do
|
|
52
52
|
logger.info "error creating New Relic deployment (#{e})\n#{e.backtrace.join("\n")}"
|
53
53
|
rescue NewRelic::Commands::CommandFailure => e
|
54
54
|
logger.info "unable to notify New Relic of the deployment (#{e})... skipping"
|
55
|
-
rescue CommandError
|
55
|
+
rescue Capistrano::CommandError
|
56
56
|
logger.info "unable to notify New Relic of the deployment... skipping"
|
57
57
|
end
|
58
58
|
# WIP: For rollbacks, let's update the deployment we created with an indication of the failure:
|
data/lib/new_relic/version.rb
CHANGED
@@ -3,7 +3,7 @@ module NewRelic
|
|
3
3
|
module VERSION #:nodoc:
|
4
4
|
MAJOR = 2
|
5
5
|
MINOR = 8
|
6
|
-
TINY =
|
6
|
+
TINY = 5
|
7
7
|
STRING = [MAJOR, MINOR, TINY].join('.')
|
8
8
|
def self.changes
|
9
9
|
puts "NewRelic RPM Plugin Version: #{NewRelic::VERSION::STRING}"
|
@@ -11,7 +11,14 @@ module NewRelic
|
|
11
11
|
end
|
12
12
|
|
13
13
|
CHANGELOG = <<EOF
|
14
|
-
|
14
|
+
2009-02-22 version 2.8.5
|
15
|
+
* fix reference to CommandError which was breaking some cap scripts
|
16
|
+
* fix incompatibility with Rails 2.0 in the server API
|
17
|
+
* fix problem with litespeed with Lite accounts
|
18
|
+
* fix problem when ActiveRecord is disabled
|
19
|
+
* moved merb instrumentation to Merb::Controller instead of
|
20
|
+
AbstractController to address incompatibility with MailController
|
21
|
+
* fix problem in devmode displaying sql with embedded urls
|
15
22
|
2009-02-17 version 2.8.4
|
16
23
|
* fix bug detecting Phusion Passenger v 2.1.0
|
17
24
|
* fix bug in capistrano recipe causing cap commands to fail with error
|
data/lib/new_relic_api.rb
CHANGED
data/lib/tasks/agent_tests.rake
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
# run unit tests for the NewRelic Agent
|
2
|
+
if defined? Rake::TestTask
|
3
|
+
|
2
4
|
namespace :test do
|
3
5
|
AGENT_HOME = File.expand_path(File.join(File.dirname(__FILE__), "..",".."))
|
4
6
|
Rake::TestTask.new(:agent) do |t|
|
@@ -11,4 +13,5 @@ namespace :test do
|
|
11
13
|
|
12
14
|
Rake::TestTask.new(:all => ["test", "test:agent"])
|
13
15
|
Rake::Task['test:all'].comment = "Run all tests including agent code"
|
14
|
-
end
|
16
|
+
end
|
17
|
+
end
|
@@ -1,11 +1,8 @@
|
|
1
1
|
require File.expand_path(File.join(File.dirname(__FILE__),'..','..','test_helper'))
|
2
|
-
##require 'new_relic/agent/transaction_sampler'
|
3
2
|
|
4
3
|
::RPM_DEVELOPER = true unless defined? ::RPM_DEVELOPER
|
5
4
|
|
6
|
-
|
7
|
-
public :builder
|
8
|
-
end
|
5
|
+
NewRelic::Agent::TransactionSampler.send :public, :builder
|
9
6
|
|
10
7
|
class NewRelic::Agent::TransationSamplerTests < Test::Unit::TestCase
|
11
8
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: newrelic_rpm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.8.
|
4
|
+
version: 2.8.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bill Kayser
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-03-04 00:00:00 -08:00
|
13
13
|
default_executable: newrelic_cmd
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -35,6 +35,7 @@ files:
|
|
35
35
|
- lib/new_relic/agent/collection_helper.rb
|
36
36
|
- lib/new_relic/agent/error_collector.rb
|
37
37
|
- lib/new_relic/agent/instrumentation
|
38
|
+
- lib/new_relic/agent/instrumentation/active_merchant.rb
|
38
39
|
- lib/new_relic/agent/instrumentation/active_record_instrumentation.rb
|
39
40
|
- lib/new_relic/agent/instrumentation/controller_instrumentation.rb
|
40
41
|
- lib/new_relic/agent/instrumentation/data_mapper.rb
|