newrelic_rpm 3.0.1 → 3.1.0.beta1

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 (74) hide show
  1. data/CHANGELOG +2 -3
  2. data/README.rdoc +3 -3
  3. data/lib/new_relic/agent.rb +19 -7
  4. data/lib/new_relic/agent/agent.rb +83 -19
  5. data/lib/new_relic/agent/beacon_configuration.rb +8 -12
  6. data/lib/new_relic/agent/browser_monitoring.rb +8 -8
  7. data/lib/new_relic/agent/error_collector.rb +13 -13
  8. data/lib/new_relic/agent/instrumentation.rb +9 -0
  9. data/lib/new_relic/agent/instrumentation/controller_instrumentation.rb +10 -2
  10. data/lib/new_relic/agent/instrumentation/metric_frame.rb +41 -35
  11. data/lib/new_relic/agent/instrumentation/metric_frame/pop.rb +92 -0
  12. data/lib/new_relic/agent/method_tracer.rb +0 -2
  13. data/lib/new_relic/agent/shim_agent.rb +2 -0
  14. data/lib/new_relic/agent/stats_engine/metric_stats.rb +89 -60
  15. data/lib/new_relic/agent/stats_engine/transactions.rb +1 -1
  16. data/lib/new_relic/agent/worker_loop.rb +1 -1
  17. data/lib/new_relic/collection_helper.rb +0 -2
  18. data/lib/new_relic/control/class_methods.rb +25 -12
  19. data/lib/new_relic/control/logging_methods.rb +30 -17
  20. data/lib/new_relic/data_serialization.rb +81 -0
  21. data/lib/new_relic/local_environment.rb +1 -1
  22. data/lib/new_relic/metric_data.rb +9 -5
  23. data/lib/new_relic/metric_spec.rb +7 -1
  24. data/lib/new_relic/rack/browser_monitoring.rb +1 -7
  25. data/lib/new_relic/stats.rb +4 -0
  26. data/lib/new_relic/transaction_analysis.rb +45 -88
  27. data/lib/new_relic/transaction_analysis/segment_summary.rb +47 -0
  28. data/lib/new_relic/transaction_sample.rb +15 -332
  29. data/lib/new_relic/transaction_sample/composite_segment.rb +27 -0
  30. data/lib/new_relic/transaction_sample/fake_segment.rb +9 -0
  31. data/lib/new_relic/transaction_sample/segment.rb +250 -0
  32. data/lib/new_relic/transaction_sample/summary_segment.rb +21 -0
  33. data/lib/new_relic/version.rb +3 -3
  34. data/newrelic.yml +3 -3
  35. data/newrelic_rpm.gemspec +27 -4
  36. data/test/active_record_fixtures.rb +31 -13
  37. data/test/new_relic/agent/agent/start_worker_thread_test.rb +1 -3
  38. data/test/new_relic/agent/agent_test.rb +73 -28
  39. data/test/new_relic/agent/agent_test_controller_test.rb +11 -10
  40. data/test/new_relic/agent/beacon_configuration_test.rb +37 -20
  41. data/test/new_relic/agent/browser_monitoring_test.rb +17 -28
  42. data/test/new_relic/agent/error_collector/notice_error_test.rb +9 -7
  43. data/test/new_relic/agent/error_collector_test.rb +6 -7
  44. data/test/new_relic/agent/instrumentation/active_record_instrumentation_test.rb +12 -5
  45. data/test/new_relic/agent/instrumentation/metric_frame/pop_test.rb +195 -0
  46. data/test/new_relic/agent/instrumentation/net_instrumentation_test.rb +60 -58
  47. data/test/new_relic/agent/instrumentation/queue_time_test.rb +14 -0
  48. data/test/new_relic/agent/instrumentation/rack_test.rb +35 -0
  49. data/test/new_relic/agent/instrumentation/task_instrumentation_test.rb +0 -1
  50. data/test/new_relic/agent/method_tracer_test.rb +8 -8
  51. data/test/new_relic/agent/sampler_test.rb +19 -0
  52. data/test/new_relic/agent/shim_agent_test.rb +20 -0
  53. data/test/new_relic/agent/stats_engine/metric_stats/harvest_test.rb +150 -0
  54. data/test/new_relic/agent/stats_engine/metric_stats_test.rb +1 -0
  55. data/test/new_relic/agent/stats_engine/samplers_test.rb +4 -3
  56. data/test/new_relic/agent/{stats_engine/stats_engine_test.rb → stats_engine_test.rb} +8 -8
  57. data/test/new_relic/agent/transaction_sampler_test.rb +1 -1
  58. data/test/new_relic/agent/worker_loop_test.rb +2 -2
  59. data/test/new_relic/control/class_methods_test.rb +62 -0
  60. data/test/new_relic/control/logging_methods_test.rb +157 -0
  61. data/test/new_relic/control_test.rb +10 -10
  62. data/test/new_relic/data_serialization_test.rb +50 -0
  63. data/test/new_relic/local_environment_test.rb +13 -13
  64. data/test/new_relic/metric_data_test.rb +125 -0
  65. data/test/new_relic/metric_spec_test.rb +8 -0
  66. data/test/new_relic/transaction_analysis/segment_summary_test.rb +77 -0
  67. data/test/new_relic/transaction_analysis_test.rb +121 -0
  68. data/test/new_relic/transaction_sample/composite_segment_test.rb +35 -0
  69. data/test/new_relic/transaction_sample/fake_segment_test.rb +17 -0
  70. data/test/new_relic/transaction_sample/segment_test.rb +454 -0
  71. data/test/new_relic/transaction_sample/summary_segment_test.rb +31 -0
  72. data/test/new_relic/transaction_sample_test.rb +51 -0
  73. data/test/test_helper.rb +4 -14
  74. metadata +32 -7
@@ -0,0 +1,31 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'test_helper'))
2
+ require 'new_relic/transaction_sample/summary_segment'
3
+ class NewRelic::TransactionSample::SummarySegmentTest < Test::Unit::TestCase
4
+ def test_summary_segment_creation
5
+ fake_segment = mock_segment
6
+ NewRelic::TransactionSample::SummarySegment.new(fake_segment)
7
+ end
8
+
9
+ def test_add_segments
10
+ fake_segment = mock_segment
11
+ ss = NewRelic::TransactionSample::SummarySegment.new(fake_segment)
12
+ other_fake_segment = mock_segment
13
+ # with the new summary segment
14
+ ss.expects(:add_called_segment).with(instance_of(NewRelic::TransactionSample::SummarySegment))
15
+ ss.add_segments([other_fake_segment])
16
+ end
17
+
18
+ private
19
+
20
+ @@seg_count = 0
21
+ def mock_segment
22
+ @@seg_count += 1
23
+ segment = mock('segment ' + @@seg_count.to_s)
24
+ segment.expects(:entry_timestamp).returns(Time.now)
25
+ segment.expects(:exit_timestamp).returns(Time.now)
26
+ segment.expects(:metric_name).returns('Custom/test/metric')
27
+ segment.expects(:called_segments).returns([])
28
+ segment
29
+ end
30
+ end
31
+
@@ -116,4 +116,55 @@ class NewRelic::TransactionSampleTest < Test::Unit::TestCase
116
116
  end
117
117
  end
118
118
 
119
+ def test_path_string
120
+ s = @t.prepare_to_send(:explain_sql => 0.1)
121
+ fake_segment = mock('segment')
122
+ fake_segment.expects(:path_string).returns('a path string')
123
+ s.instance_eval do
124
+ @root_segment = fake_segment
125
+ end
126
+
127
+ assert_equal('a path string', s.path_string)
128
+ end
129
+
130
+ def test_params_equals
131
+ s = @t.prepare_to_send(:explain_sql => 0.1)
132
+ s.params = {:params => 'hash' }
133
+ assert_equal({:params => 'hash'}, s.params, "should have the specified hash, but instead was #{s.params}")
134
+ end
135
+
136
+ class Hat
137
+ # just here to mess with the to_s logic in transaction samples
138
+ end
139
+
140
+ def test_to_s_with_bad_object
141
+ s = @t.prepare_to_send(:explain_sql => 0.1)
142
+ s.params[:fake] = Hat.new
143
+ assert_raise(RuntimeError) do
144
+ s.to_s
145
+ end
146
+ end
147
+
148
+ def test_to_s_includes_keys
149
+ s = @t.prepare_to_send(:explain_sql => 0.1)
150
+ s.params[:fake_key] = 'a fake param'
151
+ assert(s.to_s.include?('fake_key'), "should include 'fake_key' but instead was (#{s.to_s})")
152
+ assert(s.to_s.include?('a fake param'), "should include 'a fake param' but instead was (#{s.to_s})")
153
+ end
154
+
155
+ def test_find_segment
156
+ s = @t.prepare_to_send(:explain_sql => 0.1)
157
+ fake_segment = mock('segment')
158
+ fake_segment.expects(:find_segment).with(1).returns('a segment')
159
+ s.instance_eval do
160
+ @root_segment = fake_segment
161
+ end
162
+
163
+ assert_equal('a segment', s.find_segment(1))
164
+ end
165
+
166
+ def test_timestamp
167
+ s = @t.prepare_to_send(:explain_sql => 0.1)
168
+ assert(s.timestamp.instance_of?(Float), "s.timestamp should be a Float, but is #{s.timestamp.class.inspect}")
169
+ end
119
170
  end
data/test/test_helper.rb CHANGED
@@ -100,21 +100,11 @@ def assert_calls_unscoped_metrics(*metrics)
100
100
  end
101
101
 
102
102
 
103
- def compare_metrics expected_list, actual_list
104
- actual = Set.new actual_list
103
+ def compare_metrics(expected, actual)
105
104
  actual.delete('GC/cumulative') # in case we are in REE
106
- expected = Set.new expected_list
107
- assert_equal expected.to_a.sort, actual.to_a.sort, "extra: #{(actual - expected).to_a.join(", ")}; missing: #{(expected - actual).to_a.join(", ")}"
105
+ assert_equal(expected.to_a.sort, actual.to_a.sort, "extra: #{(actual - expected).to_a.inspect}; missing: #{(expected - actual).to_a.inspect}")
108
106
  end
109
- =begin Enable this to see test names as they run
110
- Test::Unit::TestCase.class_eval do
111
- def run_with_info *args, &block
112
- puts "#{self.class.name.underscore}/#{@method_name}"
113
- run_without_info *args, &block
114
- end
115
- alias_method_chain :run, :info
116
- end
117
- =end
107
+
118
108
  module TransactionSampleTestHelper
119
109
  def make_sql_transaction(*sql)
120
110
  sampler = NewRelic::Agent::TransactionSampler.new
@@ -126,7 +116,7 @@ module TransactionSampleTestHelper
126
116
 
127
117
  sql.each {|sql_statement| sampler.notice_sql(sql_statement, {:adapter => "test"}, 0 ) }
128
118
 
129
- sleep 1.0
119
+ sleep 0.02
130
120
  yield if block_given?
131
121
  sampler.notice_pop_scope "a"
132
122
  sampler.notice_scope_empty
metadata CHANGED
@@ -1,13 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newrelic_rpm
3
3
  version: !ruby/object:Gem::Version
4
- hash: 5
5
- prerelease: false
4
+ hash: 62196433
5
+ prerelease: 6
6
6
  segments:
7
7
  - 3
8
+ - 1
8
9
  - 0
10
+ - beta
9
11
  - 1
10
- version: 3.0.1
12
+ version: 3.1.0.beta1
11
13
  platform: ruby
12
14
  authors:
13
15
  - Bill Kayser
@@ -16,7 +18,7 @@ autorequire:
16
18
  bindir: bin
17
19
  cert_chain: []
18
20
 
19
- date: 2011-05-20 00:00:00 -07:00
21
+ date: 2011-05-11 00:00:00 -07:00
20
22
  default_executable:
21
23
  dependencies:
22
24
  - !ruby/object:Gem::Dependency
@@ -101,6 +103,7 @@ files:
101
103
  - lib/new_relic/agent/busy_calculator.rb
102
104
  - lib/new_relic/agent/chained_call.rb
103
105
  - lib/new_relic/agent/error_collector.rb
106
+ - lib/new_relic/agent/instrumentation.rb
104
107
  - lib/new_relic/agent/instrumentation/active_merchant.rb
105
108
  - lib/new_relic/agent/instrumentation/acts_as_solr.rb
106
109
  - lib/new_relic/agent/instrumentation/authlogic.rb
@@ -111,6 +114,7 @@ files:
111
114
  - lib/new_relic/agent/instrumentation/merb/controller.rb
112
115
  - lib/new_relic/agent/instrumentation/merb/errors.rb
113
116
  - lib/new_relic/agent/instrumentation/metric_frame.rb
117
+ - lib/new_relic/agent/instrumentation/metric_frame/pop.rb
114
118
  - lib/new_relic/agent/instrumentation/net.rb
115
119
  - lib/new_relic/agent/instrumentation/passenger_instrumentation.rb
116
120
  - lib/new_relic/agent/instrumentation/queue_time.rb
@@ -157,6 +161,7 @@ files:
157
161
  - lib/new_relic/control/logging_methods.rb
158
162
  - lib/new_relic/control/profiling.rb
159
163
  - lib/new_relic/control/server_methods.rb
164
+ - lib/new_relic/data_serialization.rb
160
165
  - lib/new_relic/delayed_job_injection.rb
161
166
  - lib/new_relic/histogram.rb
162
167
  - lib/new_relic/local_environment.rb
@@ -175,7 +180,12 @@ files:
175
180
  - lib/new_relic/stats.rb
176
181
  - lib/new_relic/timer_lib.rb
177
182
  - lib/new_relic/transaction_analysis.rb
183
+ - lib/new_relic/transaction_analysis/segment_summary.rb
178
184
  - lib/new_relic/transaction_sample.rb
185
+ - lib/new_relic/transaction_sample/composite_segment.rb
186
+ - lib/new_relic/transaction_sample/fake_segment.rb
187
+ - lib/new_relic/transaction_sample/segment.rb
188
+ - lib/new_relic/transaction_sample/summary_segment.rb
179
189
  - lib/new_relic/url_rule.rb
180
190
  - lib/new_relic/version.rb
181
191
  - lib/newrelic_rpm.rb
@@ -203,9 +213,11 @@ files:
203
213
  - test/new_relic/agent/instrumentation/active_record_instrumentation_test.rb
204
214
  - test/new_relic/agent/instrumentation/controller_instrumentation_test.rb
205
215
  - test/new_relic/agent/instrumentation/instrumentation_test.rb
216
+ - test/new_relic/agent/instrumentation/metric_frame/pop_test.rb
206
217
  - test/new_relic/agent/instrumentation/metric_frame_test.rb
207
218
  - test/new_relic/agent/instrumentation/net_instrumentation_test.rb
208
219
  - test/new_relic/agent/instrumentation/queue_time_test.rb
220
+ - test/new_relic/agent/instrumentation/rack_test.rb
209
221
  - test/new_relic/agent/instrumentation/task_instrumentation_test.rb
210
222
  - test/new_relic/agent/memcache_instrumentation_test.rb
211
223
  - test/new_relic/agent/method_tracer/class_methods/add_method_tracer_test.rb
@@ -213,19 +225,32 @@ files:
213
225
  - test/new_relic/agent/method_tracer_test.rb
214
226
  - test/new_relic/agent/mock_scope_listener.rb
215
227
  - test/new_relic/agent/rpm_agent_test.rb
228
+ - test/new_relic/agent/sampler_test.rb
229
+ - test/new_relic/agent/shim_agent_test.rb
230
+ - test/new_relic/agent/stats_engine/metric_stats/harvest_test.rb
216
231
  - test/new_relic/agent/stats_engine/metric_stats_test.rb
217
232
  - test/new_relic/agent/stats_engine/samplers_test.rb
218
- - test/new_relic/agent/stats_engine/stats_engine_test.rb
233
+ - test/new_relic/agent/stats_engine_test.rb
219
234
  - test/new_relic/agent/transaction_sample_builder_test.rb
220
235
  - test/new_relic/agent/transaction_sampler_test.rb
221
236
  - test/new_relic/agent/worker_loop_test.rb
222
237
  - test/new_relic/collection_helper_test.rb
223
238
  - test/new_relic/command/deployments_test.rb
239
+ - test/new_relic/control/class_methods_test.rb
240
+ - test/new_relic/control/logging_methods_test.rb
224
241
  - test/new_relic/control_test.rb
242
+ - test/new_relic/data_serialization_test.rb
225
243
  - test/new_relic/local_environment_test.rb
244
+ - test/new_relic/metric_data_test.rb
226
245
  - test/new_relic/metric_spec_test.rb
227
246
  - test/new_relic/rack/episodes_test.rb
228
247
  - test/new_relic/stats_test.rb
248
+ - test/new_relic/transaction_analysis/segment_summary_test.rb
249
+ - test/new_relic/transaction_analysis_test.rb
250
+ - test/new_relic/transaction_sample/composite_segment_test.rb
251
+ - test/new_relic/transaction_sample/fake_segment_test.rb
252
+ - test/new_relic/transaction_sample/segment_test.rb
253
+ - test/new_relic/transaction_sample/summary_segment_test.rb
229
254
  - test/new_relic/transaction_sample_subtest_test.rb
230
255
  - test/new_relic/transaction_sample_test.rb
231
256
  - test/new_relic/version_number_test.rb
@@ -334,7 +359,7 @@ post_install_message: |+
334
359
 
335
360
  Please see http://support.newrelic.com/faqs/docs/ruby-agent-release-notes
336
361
  for a complete description of the features and enhancements available
337
- in version 3.0 of the Ruby Agent.
362
+ in version 3.1 of the Ruby Agent.
338
363
 
339
364
  For details on this specific release, refer to the CHANGELOG file.
340
365
 
@@ -369,7 +394,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
369
394
  requirements: []
370
395
 
371
396
  rubyforge_project:
372
- rubygems_version: 1.3.7
397
+ rubygems_version: 1.5.2
373
398
  signing_key:
374
399
  specification_version: 3
375
400
  summary: New Relic Ruby Performance Monitoring Agent