newrelic_rpm 2.12.3 → 2.13.0.beta3

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.

Files changed (118) hide show
  1. data/CHANGELOG +24 -2
  2. data/README.rdoc +172 -0
  3. data/bin/newrelic +13 -0
  4. data/bin/newrelic_cmd +2 -1
  5. data/install.rb +8 -45
  6. data/lib/new_relic/agent.rb +43 -30
  7. data/lib/new_relic/agent/agent.rb +699 -631
  8. data/lib/new_relic/agent/busy_calculator.rb +81 -81
  9. data/lib/new_relic/agent/error_collector.rb +9 -6
  10. data/lib/new_relic/agent/instrumentation/active_record_instrumentation.rb +2 -2
  11. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +10 -5
  12. data/lib/new_relic/agent/instrumentation/data_mapper.rb +13 -45
  13. data/lib/new_relic/agent/instrumentation/memcache.rb +15 -4
  14. data/lib/new_relic/agent/instrumentation/metric_frame.rb +37 -29
  15. data/lib/new_relic/agent/instrumentation/rack.rb +20 -34
  16. data/lib/new_relic/agent/method_tracer.rb +9 -9
  17. data/lib/new_relic/agent/samplers/delayed_job_lock_sampler.rb +31 -31
  18. data/lib/new_relic/agent/stats_engine/metric_stats.rb +5 -5
  19. data/lib/new_relic/agent/stats_engine/samplers.rb +3 -0
  20. data/lib/new_relic/agent/transaction_sampler.rb +31 -15
  21. data/lib/new_relic/agent/worker_loop.rb +29 -28
  22. data/lib/new_relic/collection_helper.rb +4 -2
  23. data/lib/new_relic/command.rb +85 -0
  24. data/lib/new_relic/commands/deployments.rb +74 -114
  25. data/lib/new_relic/commands/install.rb +81 -0
  26. data/lib/new_relic/control.rb +54 -379
  27. data/lib/new_relic/control/configuration.rb +149 -0
  28. data/lib/new_relic/control/{external.rb → frameworks/external.rb} +2 -2
  29. data/lib/new_relic/control/{merb.rb → frameworks/merb.rb} +1 -1
  30. data/lib/new_relic/control/frameworks/rails.rb +126 -0
  31. data/lib/new_relic/control/{rails3.rb → frameworks/rails3.rb} +11 -10
  32. data/lib/new_relic/control/{ruby.rb → frameworks/ruby.rb} +1 -1
  33. data/lib/new_relic/control/{sinatra.rb → frameworks/sinatra.rb} +2 -2
  34. data/lib/new_relic/control/instrumentation.rb +84 -0
  35. data/lib/new_relic/control/logging_methods.rb +74 -0
  36. data/lib/new_relic/control/profiling.rb +24 -0
  37. data/lib/new_relic/control/server_methods.rb +88 -0
  38. data/lib/new_relic/local_environment.rb +3 -3
  39. data/lib/new_relic/metric_parser.rb +13 -2
  40. data/lib/new_relic/metric_parser/active_record.rb +4 -1
  41. data/lib/new_relic/metric_parser/apdex.rb +53 -0
  42. data/lib/new_relic/metric_parser/controller.rb +13 -5
  43. data/lib/new_relic/metric_parser/mem_cache.rb +1 -1
  44. data/lib/new_relic/metric_parser/other_transaction.rb +21 -0
  45. data/lib/new_relic/metric_spec.rb +3 -3
  46. data/lib/new_relic/noticed_error.rb +1 -1
  47. data/lib/new_relic/rack/developer_mode.rb +257 -0
  48. data/lib/new_relic/rack/metric_app.rb +56 -50
  49. data/lib/new_relic/rack/mongrel_rpm.ru +7 -6
  50. data/lib/new_relic/rack/newrelic.yml +4 -3
  51. data/lib/new_relic/rack_app.rb +2 -1
  52. data/lib/new_relic/recipes.rb +7 -7
  53. data/lib/new_relic/stats.rb +6 -14
  54. data/lib/new_relic/timer_lib.rb +27 -0
  55. data/lib/new_relic/transaction_analysis.rb +2 -7
  56. data/lib/new_relic/transaction_sample.rb +17 -85
  57. data/lib/new_relic/url_rule.rb +14 -0
  58. data/lib/new_relic/version.rb +3 -3
  59. data/lib/newrelic_rpm.rb +5 -9
  60. data/newrelic.yml +26 -9
  61. data/newrelic_rpm.gemspec +67 -32
  62. data/test/config/newrelic.yml +5 -0
  63. data/test/config/test_control.rb +6 -8
  64. data/test/new_relic/agent/active_record_instrumentation_test.rb +5 -6
  65. data/test/new_relic/agent/agent_controller_test.rb +18 -4
  66. data/test/new_relic/agent/agent_test_controller.rb +1 -6
  67. data/test/new_relic/agent/busy_calculator_test.rb +2 -0
  68. data/test/new_relic/agent/collection_helper_test.rb +6 -6
  69. data/test/new_relic/agent/error_collector_test.rb +13 -21
  70. data/test/new_relic/agent/metric_data_test.rb +3 -6
  71. data/test/new_relic/agent/rpm_agent_test.rb +121 -117
  72. data/test/new_relic/agent/task_instrumentation_test.rb +128 -133
  73. data/test/new_relic/agent/transaction_sample_test.rb +176 -170
  74. data/test/new_relic/agent/worker_loop_test.rb +24 -18
  75. data/test/new_relic/control_test.rb +13 -3
  76. data/test/new_relic/deployments_api_test.rb +7 -7
  77. data/test/new_relic/environment_test.rb +1 -1
  78. data/test/new_relic/metric_parser_test.rb +58 -4
  79. data/test/new_relic/rack/episodes_test.rb +317 -0
  80. data/test/new_relic/stats_test.rb +3 -2
  81. data/test/test_contexts.rb +28 -0
  82. data/test/test_helper.rb +24 -5
  83. data/ui/helpers/{newrelic_helper.rb → developer_mode_helper.rb} +63 -23
  84. data/ui/views/layouts/newrelic_default.rhtml +6 -6
  85. data/ui/views/newrelic/_explain_plans.rhtml +4 -4
  86. data/ui/views/newrelic/_sample.rhtml +18 -17
  87. data/ui/views/newrelic/_segment.rhtml +1 -0
  88. data/ui/views/newrelic/_segment_row.rhtml +8 -8
  89. data/ui/views/newrelic/_show_sample_detail.rhtml +1 -1
  90. data/ui/views/newrelic/_show_sample_sql.rhtml +2 -2
  91. data/ui/views/newrelic/_sql_row.rhtml +8 -3
  92. data/ui/views/newrelic/_stack_trace.rhtml +9 -24
  93. data/ui/views/newrelic/_table.rhtml +1 -1
  94. data/ui/views/newrelic/explain_sql.rhtml +3 -2
  95. data/ui/views/newrelic/{images → file/images}/arrow-close.png +0 -0
  96. data/ui/views/newrelic/{images → file/images}/arrow-open.png +0 -0
  97. data/ui/views/newrelic/{images → file/images}/blue_bar.gif +0 -0
  98. data/ui/views/newrelic/{images → file/images}/file_icon.png +0 -0
  99. data/ui/views/newrelic/{images → file/images}/gray_bar.gif +0 -0
  100. data/ui/views/newrelic/{images → file/images}/new-relic-rpm-desktop.gif +0 -0
  101. data/ui/views/newrelic/{images → file/images}/new_relic_rpm_desktop.gif +0 -0
  102. data/ui/views/newrelic/{images → file/images}/textmate.png +0 -0
  103. data/ui/views/newrelic/file/javascript/jquery-1.4.2.js +6240 -0
  104. data/ui/views/newrelic/file/javascript/transaction_sample.js +120 -0
  105. data/ui/views/newrelic/{stylesheets → file/stylesheets}/style.css +0 -0
  106. data/ui/views/newrelic/index.rhtml +7 -5
  107. data/ui/views/newrelic/sample_not_found.rhtml +1 -1
  108. data/ui/views/newrelic/show_sample.rhtml +5 -6
  109. metadata +92 -34
  110. data/README.md +0 -138
  111. data/lib/new_relic/commands/new_relic_commands.rb +0 -30
  112. data/lib/new_relic/control/rails.rb +0 -151
  113. data/test/new_relic/agent/mock_ar_connection.rb +0 -40
  114. data/test/ui/newrelic_controller_test.rb +0 -14
  115. data/test/ui/newrelic_helper_test.rb +0 -53
  116. data/ui/controllers/newrelic_controller.rb +0 -220
  117. data/ui/views/newrelic/javascript/prototype-scriptaculous.js +0 -7288
  118. data/ui/views/newrelic/javascript/transaction_sample.js +0 -107
@@ -0,0 +1,14 @@
1
+ # Represents url mapping rules stored on the server. These rules should be applied
2
+ # to URLs which are not normalized into controller class/action by Rails routes.
3
+ # Insantiated strictly by Marshal.
4
+ class NewRelic::UrlRule
5
+ attr_reader :match_expression, :replacement, :eval_order, :terminate_chain
6
+
7
+ def apply url
8
+ return nil
9
+ end
10
+
11
+ class RuleSet
12
+
13
+ end
14
+ end
@@ -2,9 +2,9 @@
2
2
  module NewRelic
3
3
  module VERSION #:nodoc:
4
4
  MAJOR = 2
5
- MINOR = 12
6
- TINY = 3
7
- BUILD = nil #'0' # Set to nil for a release, 'beta1', 'alpha', etc for prerelease builds
5
+ MINOR = 13
6
+ TINY = 0
7
+ BUILD = 'beta3' #'0' # Set to nil for a release, 'beta1', 'alpha', etc for prerelease builds
8
8
  STRING = [MAJOR, MINOR, TINY, BUILD].compact.join('.')
9
9
  end
10
10
 
data/lib/newrelic_rpm.rb CHANGED
@@ -19,22 +19,18 @@
19
19
  #
20
20
  require 'new_relic/control'
21
21
 
22
- # After verison 2.0 of Rails we can access the configuration directly.
23
- # We need it to add dev mode routes after initialization finished.
24
- if defined? Rails.configuration
25
- Rails.configuration.after_initialize do
26
- NewRelic::Control.instance.init_plugin :config => Rails.configuration
27
- end
28
- elsif defined? Merb
22
+ if defined? Merb
29
23
  module NewRelic
30
24
  class MerbBootLoader < Merb::BootLoader
31
25
  after Merb::BootLoader::ChooseAdapter
32
-
33
26
  def self.run
34
27
  NewRelic::Control.instance.init_plugin
35
28
  end
36
29
  end
37
30
  end
38
31
  else
39
- NewRelic::Control.instance.init_plugin
32
+ # After verison 2.0 of Rails we can access the configuration directly.
33
+ # We need it to add dev mode routes after initialization finished.
34
+ config = Rails.configuration if defined?(Rails.configuration)
35
+ NewRelic::Control.instance.init_plugin :config => config
40
36
  end
data/newrelic.yml CHANGED
@@ -3,13 +3,16 @@
3
3
  # Rails applications with deep visibility and low overhead. For more
4
4
  # information, visit www.newrelic.com.
5
5
  #
6
- # <%= generated_for_user %>
6
+ # Generated <%= Time.now.strftime('%B %d, %Y') %>, for version <%= NewRelic::VERSION::STRING %>
7
7
  #
8
- # here are the settings that are common to all environments
8
+ # <%= generated_for_user %>
9
+
10
+
11
+ # Here are the settings that are common to all environments
9
12
  common: &default_settings
10
13
  # ============================== LICENSE KEY ===============================
11
14
 
12
- # You must specify the licence key associated with your New Relic
15
+ # You must specify the license key associated with your New Relic
13
16
  # account. This key binds your Agent's data to your account in the
14
17
  # New Relic RPM service.
15
18
  license_key: '<%= license_key %>'
@@ -21,6 +24,7 @@ common: &default_settings
21
24
  # it from running with Rake or the console. Set to false to
22
25
  # completely turn the agent off regardless of the other settings.
23
26
  # Valid values are true, false and auto.
27
+ #
24
28
  # agent_enabled: auto
25
29
 
26
30
  # Application Name
@@ -29,9 +33,16 @@ common: &default_settings
29
33
  # into a RPM "application" on your home dashboard page. If you want
30
34
  # to map this instance into multiple apps, like "AJAX Requests" and
31
35
  # "All UI" then specify a semicolon separated list of up to three
32
- # distinct names. If you comment this out, it defaults to the
33
- # capitalized RAILS_ENV (i.e., Production, Staging, etc)
34
- app_name: My Application
36
+ # distinct names, or a yaml list. Defaults to the
37
+ # capitalized RAILS_ENV or RACK_ENV (i.e., Production, Staging, etc)
38
+ #
39
+ # Example:
40
+ #
41
+ # app_name:
42
+ # - Ajax Service
43
+ # - All Services
44
+ #
45
+ app_name: <%= @app_name %>
35
46
 
36
47
  # When "true", the agent collects performance data about your
37
48
  # application and reports this data to the NewRelic RPM service at
@@ -174,6 +185,12 @@ common: &default_settings
174
185
  # disable_memcache_instrumentation: true
175
186
  # disable_dj: true
176
187
 
188
+ # If you're interested in capturing memcache keys as though they
189
+ # were SQL uncomment this flag. Note that this does increase
190
+ # overhead slightly on every memcached call, and can have security
191
+ # implications if your memcached keys are sensitive
192
+ # capture_memcache_keys: true
193
+
177
194
  # Certain types of instrumentation such as GC stats will not work if
178
195
  # you are running multi-threaded. Please let us know.
179
196
  # multi_threaded = false
@@ -186,7 +203,7 @@ common: &default_settings
186
203
  # the environment
187
204
 
188
205
  # NOTE if your application has other named environments, you should
189
- # provide newrelic conifguration settings for these enviromnents here.
206
+ # provide newrelic configuration settings for these environments here.
190
207
 
191
208
  development:
192
209
  <<: *default_settings
@@ -215,7 +232,7 @@ test:
215
232
  # Turn on the agent in production for 24x7 monitoring. NewRelic
216
233
  # testing shows an average performance impact of < 5 ms per
217
234
  # transaction, you you can leave this on all the time without
218
- # incurring any user-visible performance degredation.
235
+ # incurring any user-visible performance degradation.
219
236
  production:
220
237
  <<: *default_settings
221
238
  monitor_mode: true
@@ -226,4 +243,4 @@ production:
226
243
  staging:
227
244
  <<: *default_settings
228
245
  monitor_mode: true
229
- app_name: My Application (Staging)
246
+ app_name: <%= @app_name %> (Staging)
data/newrelic_rpm.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{newrelic_rpm}
8
- s.version = "2.12.3"
8
+ s.version = "2.13.0.beta3"
9
9
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = ["Bill Kayser"]
12
- s.date = %q{2010-06-10}
10
+ s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Bill Kayser", "Justin George"]
12
+ s.date = %q{2010-07-07}
13
13
  s.description = %q{New Relic RPM is a Ruby performance management system, developed by
14
14
  New Relic, Inc (http://www.newrelic.com). RPM provides you with deep
15
15
  information about the performance of your Ruby on Rails or Merb
@@ -18,16 +18,19 @@ dual-purposed as a either a Rails plugin or a Gem, hosted on
18
18
  http://github.com/newrelic/rpm/tree/master.
19
19
  }
20
20
  s.email = %q{support@newrelic.com}
21
- s.executables = ["mongrel_rpm", "newrelic_cmd"]
21
+ s.executables = ["mongrel_rpm", "newrelic", "newrelic_cmd"]
22
22
  s.extra_rdoc_files = [
23
23
  "CHANGELOG",
24
- "LICENSE"
24
+ "LICENSE",
25
+ "README.rdoc",
26
+ "newrelic.yml"
25
27
  ]
26
28
  s.files = [
27
29
  "CHANGELOG",
28
30
  "LICENSE",
29
- "README.md",
31
+ "README.rdoc",
30
32
  "bin/mongrel_rpm",
33
+ "bin/newrelic",
31
34
  "bin/newrelic_cmd",
32
35
  "cert/cacert.pem",
33
36
  "install.rb",
@@ -72,15 +75,21 @@ http://github.com/newrelic/rpm/tree/master.
72
75
  "lib/new_relic/agent/transaction_sampler.rb",
73
76
  "lib/new_relic/agent/worker_loop.rb",
74
77
  "lib/new_relic/collection_helper.rb",
78
+ "lib/new_relic/command.rb",
75
79
  "lib/new_relic/commands/deployments.rb",
76
- "lib/new_relic/commands/new_relic_commands.rb",
80
+ "lib/new_relic/commands/install.rb",
77
81
  "lib/new_relic/control.rb",
78
- "lib/new_relic/control/external.rb",
79
- "lib/new_relic/control/merb.rb",
80
- "lib/new_relic/control/rails.rb",
81
- "lib/new_relic/control/rails3.rb",
82
- "lib/new_relic/control/ruby.rb",
83
- "lib/new_relic/control/sinatra.rb",
82
+ "lib/new_relic/control/configuration.rb",
83
+ "lib/new_relic/control/frameworks/external.rb",
84
+ "lib/new_relic/control/frameworks/merb.rb",
85
+ "lib/new_relic/control/frameworks/rails.rb",
86
+ "lib/new_relic/control/frameworks/rails3.rb",
87
+ "lib/new_relic/control/frameworks/ruby.rb",
88
+ "lib/new_relic/control/frameworks/sinatra.rb",
89
+ "lib/new_relic/control/instrumentation.rb",
90
+ "lib/new_relic/control/logging_methods.rb",
91
+ "lib/new_relic/control/profiling.rb",
92
+ "lib/new_relic/control/server_methods.rb",
84
93
  "lib/new_relic/delayed_job_injection.rb",
85
94
  "lib/new_relic/histogram.rb",
86
95
  "lib/new_relic/local_environment.rb",
@@ -90,6 +99,7 @@ http://github.com/newrelic/rpm/tree/master.
90
99
  "lib/new_relic/metric_parser/action_mailer.rb",
91
100
  "lib/new_relic/metric_parser/active_merchant.rb",
92
101
  "lib/new_relic/metric_parser/active_record.rb",
102
+ "lib/new_relic/metric_parser/apdex.rb",
93
103
  "lib/new_relic/metric_parser/controller.rb",
94
104
  "lib/new_relic/metric_parser/controller_cpu.rb",
95
105
  "lib/new_relic/metric_parser/errors.rb",
@@ -102,14 +112,17 @@ http://github.com/newrelic/rpm/tree/master.
102
112
  "lib/new_relic/metric_spec.rb",
103
113
  "lib/new_relic/metrics.rb",
104
114
  "lib/new_relic/noticed_error.rb",
115
+ "lib/new_relic/rack/developer_mode.rb",
105
116
  "lib/new_relic/rack/metric_app.rb",
106
117
  "lib/new_relic/rack/mongrel_rpm.ru",
107
118
  "lib/new_relic/rack/newrelic.yml",
108
119
  "lib/new_relic/rack_app.rb",
109
120
  "lib/new_relic/recipes.rb",
110
121
  "lib/new_relic/stats.rb",
122
+ "lib/new_relic/timer_lib.rb",
111
123
  "lib/new_relic/transaction_analysis.rb",
112
124
  "lib/new_relic/transaction_sample.rb",
125
+ "lib/new_relic/url_rule.rb",
113
126
  "lib/new_relic/version.rb",
114
127
  "lib/new_relic_api.rb",
115
128
  "lib/newrelic_rpm.rb",
@@ -132,7 +145,6 @@ http://github.com/newrelic/rpm/tree/master.
132
145
  "test/new_relic/agent/method_tracer_test.rb",
133
146
  "test/new_relic/agent/metric_data_test.rb",
134
147
  "test/new_relic/agent/metric_frame_test.rb",
135
- "test/new_relic/agent/mock_ar_connection.rb",
136
148
  "test/new_relic/agent/mock_scope_listener.rb",
137
149
  "test/new_relic/agent/net_instrumentation_test.rb",
138
150
  "test/new_relic/agent/rpm_agent_test.rb",
@@ -150,15 +162,14 @@ http://github.com/newrelic/rpm/tree/master.
150
162
  "test/new_relic/environment_test.rb",
151
163
  "test/new_relic/metric_parser_test.rb",
152
164
  "test/new_relic/metric_spec_test.rb",
165
+ "test/new_relic/rack/episodes_test.rb",
153
166
  "test/new_relic/shim_agent_test.rb",
154
167
  "test/new_relic/stats_test.rb",
155
168
  "test/new_relic/version_number_test.rb",
169
+ "test/test_contexts.rb",
156
170
  "test/test_helper.rb",
157
- "test/ui/newrelic_controller_test.rb",
158
- "test/ui/newrelic_helper_test.rb",
159
- "ui/controllers/newrelic_controller.rb",
171
+ "ui/helpers/developer_mode_helper.rb",
160
172
  "ui/helpers/google_pie_chart.rb",
161
- "ui/helpers/newrelic_helper.rb",
162
173
  "ui/views/layouts/newrelic_default.rhtml",
163
174
  "ui/views/newrelic/_explain_plans.rhtml",
164
175
  "ui/views/newrelic/_sample.rhtml",
@@ -172,33 +183,51 @@ http://github.com/newrelic/rpm/tree/master.
172
183
  "ui/views/newrelic/_stack_trace.rhtml",
173
184
  "ui/views/newrelic/_table.rhtml",
174
185
  "ui/views/newrelic/explain_sql.rhtml",
175
- "ui/views/newrelic/images/arrow-close.png",
176
- "ui/views/newrelic/images/arrow-open.png",
177
- "ui/views/newrelic/images/blue_bar.gif",
178
- "ui/views/newrelic/images/file_icon.png",
179
- "ui/views/newrelic/images/gray_bar.gif",
180
- "ui/views/newrelic/images/new-relic-rpm-desktop.gif",
181
- "ui/views/newrelic/images/new_relic_rpm_desktop.gif",
182
- "ui/views/newrelic/images/textmate.png",
186
+ "ui/views/newrelic/file/images/arrow-close.png",
187
+ "ui/views/newrelic/file/images/arrow-open.png",
188
+ "ui/views/newrelic/file/images/blue_bar.gif",
189
+ "ui/views/newrelic/file/images/file_icon.png",
190
+ "ui/views/newrelic/file/images/gray_bar.gif",
191
+ "ui/views/newrelic/file/images/new-relic-rpm-desktop.gif",
192
+ "ui/views/newrelic/file/images/new_relic_rpm_desktop.gif",
193
+ "ui/views/newrelic/file/images/textmate.png",
194
+ "ui/views/newrelic/file/javascript/jquery-1.4.2.js",
195
+ "ui/views/newrelic/file/javascript/transaction_sample.js",
196
+ "ui/views/newrelic/file/stylesheets/style.css",
183
197
  "ui/views/newrelic/index.rhtml",
184
- "ui/views/newrelic/javascript/prototype-scriptaculous.js",
185
- "ui/views/newrelic/javascript/transaction_sample.js",
186
198
  "ui/views/newrelic/sample_not_found.rhtml",
187
199
  "ui/views/newrelic/show_sample.rhtml",
188
200
  "ui/views/newrelic/show_source.rhtml",
189
- "ui/views/newrelic/stylesheets/style.css",
190
201
  "ui/views/newrelic/threads.rhtml"
191
202
  ]
192
203
  s.homepage = %q{http://www.github.com/newrelic/rpm}
193
204
  s.post_install_message = %q{
205
+ PLEASE NOTE:
206
+
207
+ Developer Mode is now a Rack middleware.
208
+
209
+ RPM Developer Mode is no longer available in Rails 2.1 and earlier.
210
+ However, starting in version 2.12 you can use Developer Mode in any
211
+ Rack based framework, in addition to Rails. To install developer mode
212
+ in a non-Rails application, just add NewRelic::Rack::DeveloperMode to
213
+ your middleware stack.
214
+
215
+ If you are using JRuby, we recommend using at least version 1.4 or
216
+ later because of issues with the implementation of the timeout library.
217
+
218
+ Refer to the README.md file for more information.
219
+
194
220
  Please see http://support.newrelic.com/faqs/docs/ruby-agent-release-notes
195
221
  for a complete description of the features and enhancements available
196
- in version 2.12 of the Ruby Agent.
222
+ in version 2.13 of the Ruby Agent.
197
223
 
198
224
  For details on this specific release, refer to the CHANGELOG file.
199
225
 
226
+ Notice: Developer Mode now supports only Rails 2.3+ - refer to README
227
+ for instructions for previous versions
228
+
200
229
  }
201
- s.rdoc_options = ["--charset=UTF-8", "--line-numbers", "--inline-source", "--title", "New Relic RPM"]
230
+ s.rdoc_options = ["--charset=UTF-8", "--line-numbers", "--inline-source", "--title", "New Relic Ruby Performance Monitoring Agent"]
202
231
  s.require_paths = ["lib"]
203
232
  s.rubygems_version = %q{1.3.6}
204
233
  s.summary = %q{New Relic Ruby Performance Monitoring Agent}
@@ -209,11 +238,17 @@ For details on this specific release, refer to the CHANGELOG file.
209
238
 
210
239
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
211
240
  s.add_development_dependency(%q<jeweler>, [">= 0"])
241
+ s.add_development_dependency(%q<mocha>, [">= 0"])
242
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
212
243
  else
213
244
  s.add_dependency(%q<jeweler>, [">= 0"])
245
+ s.add_dependency(%q<mocha>, [">= 0"])
246
+ s.add_dependency(%q<shoulda>, [">= 0"])
214
247
  end
215
248
  else
216
249
  s.add_dependency(%q<jeweler>, [">= 0"])
250
+ s.add_dependency(%q<mocha>, [">= 0"])
251
+ s.add_dependency(%q<shoulda>, [">= 0"])
217
252
  end
218
253
  end
219
254
 
@@ -20,6 +20,11 @@ test:
20
20
  license_key: '<%= license_key %>'
21
21
  agent_enabled: auto
22
22
  apdex_t: 1.1
23
+ app_name:
24
+ - a
25
+ - b
26
+ - c
27
+ log_file_path: <%= RAILS_ROOT %>/log
23
28
 
24
29
  # Some fixtures for newrelic.yml parsing tests
25
30
  erb_value: <%= 'hey'*3 %>
@@ -1,17 +1,15 @@
1
- require 'new_relic/control/rails'
1
+ require 'new_relic/control/frameworks/rails'
2
2
 
3
- class NewRelic::Control::Test < NewRelic::Control::Rails #:nodoc:
3
+ class NewRelic::Control::Frameworks::Test < NewRelic::Control::Frameworks::Rails #:nodoc:
4
4
  def env
5
5
  'test'
6
6
  end
7
7
  def app
8
8
  :rails
9
9
  end
10
- def config_file
11
- File.join(File.dirname(__FILE__), "newrelic.yml")
12
- end
13
- def initialize local_env
14
- super local_env
10
+
11
+ def initialize *args
12
+ super
15
13
  setup_log
16
14
  end
17
15
  # when running tests, don't write out stderr
@@ -35,4 +33,4 @@ class NewRelic::Control::Test < NewRelic::Control::Rails #:nodoc:
35
33
  # Force the routes to be reloaded
36
34
  ActionController::Routing::Routes.reload!
37
35
  end
38
- end
36
+ end
@@ -1,6 +1,6 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__),'..','..','test_helper'))
2
- require 'active_record_fixtures'
3
2
  class ActiveRecordInstrumentationTest < Test::Unit::TestCase
3
+ require 'active_record_fixtures'
4
4
  include NewRelic::Agent::Instrumentation::ControllerInstrumentation
5
5
  def setup
6
6
  super
@@ -172,7 +172,7 @@ class ActiveRecordInstrumentationTest < Test::Unit::TestCase
172
172
  segment = sample.root_segment.called_segments.first.called_segments.first.called_segments.first
173
173
  assert_match /^SELECT \* FROM ["`]?#{ActiveRecordFixtures::Order.table_name}["`]?$/i, segment.params[:sql].strip
174
174
  NewRelic::TransactionSample::Segment.any_instance.expects(:explain_sql).returns([])
175
- sample = sample.prepare_to_send(:obfuscate_sql => true, :explain_enabled => true, :explain_sql => 0.0)
175
+ sample = sample.prepare_to_send(:record_sql => :obfuscated, :explain_sql => 0.0)
176
176
  segment = sample.root_segment.called_segments.first.called_segments.first
177
177
  end
178
178
  def test_prepare_to_send
@@ -188,7 +188,7 @@ class ActiveRecordInstrumentationTest < Test::Unit::TestCase
188
188
  assert_not_nil sql_segment, sample.to_s
189
189
  assert_match /^SELECT /, sql_segment.params[:sql]
190
190
  assert sql_segment.duration > 0.0, "Segment duration must be greater than zero."
191
- sample = sample.prepare_to_send(:record_sql => :raw, :explain_enabled => true, :explain_sql => 0.0)
191
+ sample = sample.prepare_to_send(:record_sql => :raw, :explain_sql => 0.0)
192
192
  sql_segment = sample.root_segment.called_segments.first.called_segments.first.called_segments.first
193
193
  assert_match /^SELECT /, sql_segment.params[:sql]
194
194
  explanations = sql_segment.params[:explanation]
@@ -207,9 +207,8 @@ class ActiveRecordInstrumentationTest < Test::Unit::TestCase
207
207
 
208
208
  sample = NewRelic::Agent.instance.transaction_sampler.last_sample
209
209
 
210
- sample = sample.prepare_to_send(:obfuscate_sql => true, :explain_enabled => true, :explain_sql => 0.0)
210
+ sample = sample.prepare_to_send(:record_sql => :obfuscated, :explain_sql => 0.0)
211
211
  segment = sample.root_segment.called_segments.first.called_segments.first.called_segments.first
212
- assert_nil segment.params[:sql], "SQL should have been removed."
213
212
  explanations = segment.params[:explanation]
214
213
  if isMysql? || isPostgres?
215
214
  assert_not_nil explanations, "No explains in segment: #{segment}"
@@ -284,4 +283,4 @@ class ActiveRecordInstrumentationTest < Test::Unit::TestCase
284
283
  def isMysql?
285
284
  ActiveRecordFixtures::Order.connection.class.name =~ /mysql/i
286
285
  end
287
- end
286
+ end if defined? Rails
@@ -1,8 +1,8 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__),'..','..','test_helper'))
2
- require 'action_controller/base'
3
- require 'new_relic/agent/agent_test_controller'
4
2
 
5
3
  class AgentControllerTest < ActionController::TestCase
4
+ require 'action_controller/base'
5
+ require 'new_relic/agent/agent_test_controller'
6
6
 
7
7
  self.controller_class = NewRelic::Agent::AgentTestController
8
8
 
@@ -12,6 +12,19 @@ class AgentControllerTest < ActionController::TestCase
12
12
  # setup is not called.
13
13
  def initialize name
14
14
  super name
15
+
16
+ # Suggested by cee-dub for merb tests. I'm actually amazed if our tests work with merb.
17
+ if defined?(Merb::Router)
18
+ Merb::Router.prepare do |r|
19
+ match('/:controller(/:action)(.:format)').register
20
+ end
21
+ else
22
+ ActionController::Routing::Routes.draw do | map |
23
+ map.connect '/:controller/:action.:format'
24
+ map.connect '/:controller/:action'
25
+ end
26
+ end
27
+
15
28
  Thread.current[:newrelic_ignore_controller] = nil
16
29
  NewRelic::Agent.manual_start
17
30
  @agent = NewRelic::Agent.instance
@@ -226,7 +239,7 @@ class AgentControllerTest < ActionController::TestCase
226
239
  queue_time_stat = stats('WebFrontend/Mongrel/Average Queue Time')
227
240
 
228
241
  # no request start header
229
- get :index
242
+ get 'index'
230
243
  assert_equal 0, queue_length_stat.call_count
231
244
 
232
245
  # apache version of header
@@ -277,4 +290,5 @@ class AgentControllerTest < ActionController::TestCase
277
290
  engine.get_stats_no_scope(name)
278
291
  end
279
292
 
280
- end
293
+ end if defined? Rails
294
+