newrelic_rpm 3.5.8.64.beta → 3.5.8.70

Sign up to get free protection for your applications and to get access to all the features.
data.tar.gz.sig CHANGED
@@ -1,3 +1,2 @@
1
- :�����]F4��Di<F͙�Zb�R�xX~��PӁI吘�[s/t����Mw/�žUi{��Ӆ
2
- �)��7j��\�����j�r}Q�X����U��&��U-�'I�e. ��M�G��f��sw
3
- �}A�;ŏ�0_F��W鶐@����-�����l.��X��>�jE0d�/���ŚͨdCQ̴h�}y���mt�-�s����E�+������S⓫��_��g���۝�� 28�yx�0ٟH�
1
+ xr��O=2����$ZX���0����jU�R��[�Z��1�c��K��������i�Pa�s,�+ ��ď����}��h8'=2�R�,��tCd�+��xa,�����+Bْ9غ���
2
+ �-����S_�.�5�9V�$�
data/Gemfile CHANGED
@@ -1,11 +1,15 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
 
3
3
  group :development do
4
4
  # require 0.9.2.2.
5
5
  # There's problems with the test task in rake 10
6
6
  # https://github.com/jimweirich/rake/issues/144
7
7
  gem 'rake', '0.9.2.2'
8
- gem 'mocha', '~>0.12.0'
8
+ if RUBY_VERSION > '1.9.0'
9
+ gem 'mocha', '~>0.13.0'
10
+ else
11
+ gem 'mocha', '~>0.12.0'
12
+ end
9
13
  gem 'shoulda', '~>3.0.1'
10
14
  gem 'sdoc-helpers'
11
15
  gem 'rdoc', '>= 2.4.2'
@@ -7,9 +7,14 @@ module NewRelic
7
7
  class CrossAppMonitor
8
8
 
9
9
  NEWRELIC_ID_HEADER = 'X-NewRelic-ID'
10
- NEWRELIC_TXN_HEADER = 'X-NewRelic-Transaction'
11
10
  NEWRELIC_APPDATA_HEADER = 'X-NewRelic-App-Data'
12
- NEWRELIC_ID_HEADER_KEYS = %W{#{NEWRELIC_ID_HEADER} HTTP_X_NEWRELIC_ID X_NEWRELIC_ID}
11
+ NEWRELIC_TXN_HEADER = 'X-NewRelic-Transaction'
12
+ NEWRELIC_TXN_HEADER_KEYS = %W{
13
+ #{NEWRELIC_TXN_HEADER} HTTP_X_NEWRELIC_TRANSACTION X_NEWRELIC_TRANSACTION
14
+ }
15
+ NEWRELIC_ID_HEADER_KEYS = %W{
16
+ #{NEWRELIC_ID_HEADER} HTTP_X_NEWRELIC_ID X_NEWRELIC_ID
17
+ }
13
18
  CONTENT_LENGTH_HEADER_KEYS = %w{Content-Length HTTP_CONTENT_LENGTH CONTENT_LENGTH}
14
19
 
15
20
  # Because we aren't in the right spot when our transaction actually
@@ -26,7 +31,7 @@ module NewRelic
26
31
  module_function
27
32
 
28
33
  def obfuscate_with_key(key, text)
29
- [ encode_with_key(key, text) ].pack('m').chomp
34
+ [ encode_with_key(key, text) ].pack('m').chomp.gsub(/\n/, '')
30
35
  end
31
36
 
32
37
  def decode_with_key(key, text)
@@ -104,9 +109,12 @@ module NewRelic
104
109
 
105
110
  def save_referring_transaction_info(request_headers)
106
111
  key = NewRelic::Agent.config[:encoding_key]
107
- txn_header = request_headers[NEWRELIC_TXN_HEADER] or return
112
+ txn_header = from_headers( request_headers, NEWRELIC_TXN_HEADER_KEYS ) or return
108
113
  txn_header = decode_with_key( key, txn_header )
109
- NewRelic::Agent::AgentThread.current[THREAD_TXN_KEY] = NewRelic.json_load( txn_header )
114
+ txn_info = NewRelic.json_load( txn_header )
115
+ NewRelic::Agent.logger.debug "Referring txn_info: %p" % [ txn_info ]
116
+
117
+ NewRelic::Agent::AgentThread.current[THREAD_TXN_KEY] = txn_info
110
118
  end
111
119
 
112
120
  def clear_referring_transaction_info
@@ -167,8 +175,8 @@ module NewRelic
167
175
  payload = [
168
176
  NewRelic::Agent.config[:cross_process_id],
169
177
  transaction_name,
170
- timings.queue_time_in_seconds,
171
- timings.app_time_in_seconds,
178
+ timings.queue_time_in_seconds.to_f,
179
+ timings.app_time_in_seconds.to_f,
172
180
  content_length,
173
181
  transaction_guid()
174
182
  ]
@@ -179,10 +187,11 @@ module NewRelic
179
187
  def set_transaction_custom_parameters
180
188
  # We expect to get the before call to set the id (if we have it) before
181
189
  # this, and then write our custom parameter when the transaction starts
182
- NewRelic::Agent.add_custom_parameters(:client_cross_process_id => client_cross_app_id) if client_cross_app_id()
183
- NewRelic::Agent.add_custom_parameters(:transaction_guid => transaction_guid()) if transaction_guid()
184
- NewRelic::Agent.add_custom_parameters(:transaction_referring_guid => client_referring_transaction_guid()) if
190
+ NewRelic::Agent.add_custom_parameters(:client_cross_process_id => client_cross_app_id()) if client_cross_app_id()
191
+ NewRelic::Agent.add_custom_parameters(:referring_transaction_guid => client_referring_transaction_guid()) if
185
192
  client_referring_transaction_guid()
193
+
194
+ NewRelic::Agent.logger.debug "Referring transaction guid: %p" % [client_referring_transaction_guid()]
186
195
  end
187
196
 
188
197
  def set_error_custom_parameters(options)
@@ -388,10 +388,12 @@ module NewRelic
388
388
  def path_class_and_action(options)
389
389
  metric_class = options[:class_name]
390
390
 
391
- if !metric_class && (self.is_a?(Class) || self.is_a?(Module))
392
- metric_class = self.name
393
- else
394
- metric_class = self.class.name
391
+ if !metric_class
392
+ if (self.is_a?(Class) || self.is_a?(Module))
393
+ metric_class = self.name
394
+ else
395
+ metric_class = self.class.name
396
+ end
395
397
  end
396
398
 
397
399
  [ metric_class, options[:name] ].compact.join('/')
@@ -0,0 +1,145 @@
1
+ # encoding: utf-8
2
+ # This file is distributed under New Relic's license terms.
3
+ # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
4
+
5
+ module NewRelic
6
+ module Agent
7
+ module Instrumentation
8
+ module Rails4
9
+ module ActionController
10
+ def self.newrelic_write_attr(attr_name, value) # :nodoc:
11
+ write_inheritable_attribute(attr_name, value)
12
+ end
13
+
14
+ def self.newrelic_read_attr(attr_name) # :nodoc:
15
+ read_inheritable_attribute(attr_name)
16
+ end
17
+
18
+ # determine the path that is used in the metric name for
19
+ # the called controller action
20
+ def newrelic_metric_path(action_name_override = nil)
21
+ action_part = action_name_override || action_name
22
+ if action_name_override || self.class.action_methods.include?(action_part)
23
+ "#{self.class.controller_path}/#{action_part}"
24
+ else
25
+ "#{self.class.controller_path}/(other)"
26
+ end
27
+ end
28
+
29
+ def process_action(*args)
30
+ # skip instrumentation if we are in an ignored action
31
+ if _is_filtered?('do_not_trace')
32
+ NewRelic::Agent.disable_all_tracing do
33
+ return super
34
+ end
35
+ end
36
+
37
+ perform_action_with_newrelic_trace(:category => :controller, :name => self.action_name, :path => newrelic_metric_path, :params => request.filtered_parameters, :class_name => self.class.name) do
38
+ super
39
+ end
40
+ end
41
+
42
+ end
43
+
44
+ module ActionView
45
+ module NewRelic
46
+ extend self
47
+ def template_metric(identifier, options = {})
48
+ if options[:file]
49
+ "file"
50
+ elsif identifier.nil?
51
+ "(unknown)"
52
+ elsif identifier.include? '/' # this is a filepath
53
+ identifier.split('/')[-2..-1].join('/')
54
+ else
55
+ identifier
56
+ end
57
+ end
58
+ def render_type(file_path)
59
+ file = File.basename(file_path)
60
+ if file.starts_with?('_')
61
+ return 'Partial'
62
+ else
63
+ return 'Rendering'
64
+ end
65
+ end
66
+ end
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
72
+
73
+ DependencyDetection.defer do
74
+ @name = :rails4_controller
75
+
76
+ depends_on do
77
+ defined?(::Rails) && ::Rails::VERSION::MAJOR.to_i == 4
78
+ end
79
+
80
+ depends_on do
81
+ defined?(ActionController) && defined?(ActionController::Base)
82
+ end
83
+
84
+ executes do
85
+ ::NewRelic::Agent.logger.info 'Installing Rails 4 Controller instrumentation'
86
+ end
87
+
88
+ executes do
89
+ class ActionController::Base
90
+ include NewRelic::Agent::Instrumentation::ControllerInstrumentation
91
+ include NewRelic::Agent::Instrumentation::Rails4::ActionController
92
+ end
93
+ end
94
+ end
95
+
96
+ DependencyDetection.defer do
97
+ @name = :rails40_view
98
+
99
+ depends_on do
100
+ defined?(::Rails) && ::Rails::VERSION::MAJOR.to_i == 4
101
+ end
102
+
103
+ depends_on do
104
+ !NewRelic::Agent.config[:disable_view_instrumentation]
105
+ end
106
+
107
+ executes do
108
+ ::NewRelic::Agent.logger.info 'Installing Rails 4 view instrumentation'
109
+ end
110
+
111
+ executes do
112
+ ActionView::TemplateRenderer.class_eval do
113
+ include NewRelic::Agent::MethodTracer
114
+ # namespaced helper methods
115
+
116
+ def render_with_newrelic(context, options)
117
+ @details = extract_details(options) if respond_to? :extract_details, true
118
+ identifier = determine_template(options) ? determine_template(options).identifier : nil
119
+ str = "View/#{NewRelic::Agent::Instrumentation::Rails4::ActionView::NewRelic.template_metric(identifier, options)}/Rendering"
120
+ trace_execution_scoped str do
121
+ render_without_newrelic(context, options)
122
+ end
123
+ end
124
+
125
+ alias_method :render_without_newrelic, :render
126
+ alias_method :render, :render_with_newrelic
127
+ end
128
+
129
+ ActionView::PartialRenderer.class_eval do
130
+ include NewRelic::Agent::MethodTracer
131
+
132
+ def render_with_newrelic(*args, &block)
133
+ setup(*args, &block)
134
+ identifier = find_partial ? find_partial.identifier : nil
135
+ str = "View/#{NewRelic::Agent::Instrumentation::Rails4::ActionView::NewRelic.template_metric(identifier)}/Partial"
136
+ trace_execution_scoped str do
137
+ render_without_newrelic(*args, &block)
138
+ end
139
+ end
140
+
141
+ alias_method :render_without_newrelic, :render
142
+ alias_method :render, :render_with_newrelic
143
+ end
144
+ end
145
+ end
@@ -0,0 +1,45 @@
1
+ # encoding: utf-8
2
+ # This file is distributed under New Relic's license terms.
3
+ # See https://github.com/newrelic/rpm/blob/master/LICENSE for complete details.
4
+
5
+ module NewRelic
6
+ module Agent
7
+ module Instrumentation
8
+ module Rails4
9
+ module Errors
10
+ def newrelic_notice_error(exception, custom_params = {})
11
+ filtered_params = (respond_to? :filter_parameters) ? filter_parameters(params) : params
12
+ filtered_params.merge!(custom_params)
13
+ NewRelic::Agent::Instrumentation::MetricFrame.notice_error( \
14
+ exception, \
15
+ :request => request, \
16
+ :metric => newrelic_metric_path, \
17
+ :custom_params => filtered_params)
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
24
+
25
+ DependencyDetection.defer do
26
+ @name = :rails4_error
27
+
28
+ depends_on do
29
+ defined?(::Rails) && ::Rails.respond_to?(:version) && ::Rails.version.to_i == 4
30
+ end
31
+
32
+ depends_on do
33
+ defined?(ActionController) && defined?(ActionController::Base)
34
+ end
35
+
36
+ executes do
37
+ ::NewRelic::Agent.logger.info 'Installing Rails4 Error instrumentation'
38
+ end
39
+
40
+ executes do
41
+ class ActionController::Base
42
+ include NewRelic::Agent::Instrumentation::Rails4::Errors
43
+ end
44
+ end
45
+ end
@@ -1,2 +1,2 @@
1
- # GITSHA: c6b10366c93b81b0fcab3b8fe19d565dd525b039
2
- module NewRelic; module VERSION; BUILD='64.beta'; end; end
1
+ # GITSHA: 7f84cb6c12bae5f32b489a4ac5b3b7c28d5cb3f6
2
+ module NewRelic; module VERSION; BUILD='70'; end; end
@@ -1,5 +1,9 @@
1
1
  gemfile <<-RB
2
2
  gem 'rack'
3
3
  gem 'rack-test'
4
- gem 'mocha', '< 0.13'
4
+ if RUBY_VERSION >= '1.9.0'
5
+ gem 'mocha', '~> 0.13.0'
6
+ else
7
+ gem 'mocha', '< 0.13'
8
+ end
5
9
  RB
@@ -17,6 +17,7 @@ class ResqueTest < Test::Unit::TestCase
17
17
  $collector.run(COLLECTOR_PORT)
18
18
  $redis.del('queue:resque_test')
19
19
  $redis.set('index_key', 0)
20
+ Resque::Stat.clear('processed')
20
21
  @pidfile = "resque_test.#{$$}.pid"
21
22
  JOB_COUNT.times do |i|
22
23
  Resque.enqueue(JobForTesting, 'index_key', i + 1)
@@ -89,7 +90,7 @@ class ResqueTest < Test::Unit::TestCase
89
90
  def wait_for_jobs
90
91
  time_for_jobs = 5
91
92
  begin
92
- Timeout.timeout(time_for_jobs) { sleep(0.1) until Resque.info[:pending].zero? }
93
+ Timeout.timeout(time_for_jobs) { sleep(0.1) until Resque.info[:processed] == JOB_COUNT }
93
94
  rescue Timeout::Error => err
94
95
  raise err.exception("waiting #{time_for_jobs}s for completion of #{JOB_COUNT} jobs")
95
96
  end
@@ -57,6 +57,7 @@ module NewRelic::Agent
57
57
 
58
58
  when_request_runs
59
59
 
60
+ assert_equal 'WyJxd2VydHkiLCJ0cmFuc2FjdGlvbiIsMTAwMC4wLDIwMDAuMCwtMSwiOTQxQjBFODAwMUU0NDRFOCJd', response_app_data
60
61
  assert_equal [AGENT_CROSS_APP_ID, TRANSACTION_NAME, QUEUE_TIME, APP_TIME, -1, TRANSACTION_GUID], unpacked_response
61
62
  end
62
63
 
@@ -136,8 +137,7 @@ module NewRelic::Agent
136
137
  with_default_timings
137
138
 
138
139
  NewRelic::Agent.expects(:add_custom_parameters).with(:client_cross_process_id => REQUEST_CROSS_APP_ID)
139
- NewRelic::Agent.expects(:add_custom_parameters).with(:transaction_guid => TRANSACTION_GUID)
140
- NewRelic::Agent.expects(:add_custom_parameters).with(:transaction_referring_guid => REF_TRANSACTION_GUID)
140
+ NewRelic::Agent.expects(:add_custom_parameters).with(:referring_transaction_guid => REF_TRANSACTION_GUID)
141
141
 
142
142
  when_request_runs
143
143
  end
@@ -45,7 +45,7 @@ module NewRelic::Agent::Instrumentation
45
45
  t = BrowserMonitoringTimings.new(1000, @transaction)
46
46
  original = t.app_time_in_seconds
47
47
 
48
- Time.stubs(:now).returns(3000)
48
+ Time.stubs(:now).returns(Time.at(3000))
49
49
  later = t.app_time_in_seconds
50
50
 
51
51
  assert_equal original, later
@@ -89,4 +89,19 @@ class NewRelic::Agent::Instrumentation::ControllerInstrumentationTest < Test::Un
89
89
  NewRelic::Agent.instance.instance_variable_set(:@transaction_rules,
90
90
  NewRelic::Agent::RulesEngine.new)
91
91
  end
92
+
93
+ def test_path_class_and_action
94
+ result = @object.send(:path_class_and_action, {})
95
+ assert_equal("NewRelic::Agent::Instrumentation::ControllerInstrumentationTest::TestObject", result)
96
+ end
97
+
98
+ def test_path_class_and_action_with_name
99
+ result = @object.send(:path_class_and_action, :name => "test")
100
+ assert_equal("NewRelic::Agent::Instrumentation::ControllerInstrumentationTest::TestObject/test", result)
101
+ end
102
+
103
+ def test_path_class_and_action_with_overridden_class_name
104
+ result = @object.send(:path_class_and_action, :name => "perform", :class_name => 'Resque')
105
+ assert_equal("Resque/perform", result)
106
+ end
92
107
  end
@@ -269,7 +269,12 @@ class NewRelic::Agent::Instrumentation::NetInstrumentationTest < Test::Unit::Tes
269
269
 
270
270
  def test_adds_a_request_header_to_outgoing_requests_if_xp_enabled
271
271
  @socket.check_write do |data|
272
- assert_match /(?i:x-newrelic-id): VURQV1BZRkZdXUFT/, data
272
+
273
+ # assert_match /(?i:x-newrelic-id): VURQV1BZRkZdXUFT/, data
274
+ # The above assertion won't work in Ruby 2.0.0-p0 because of a bug in the
275
+ # regexp engine. Until that's fixed we'll check the header name case
276
+ # sensitively.
277
+ assert_match /X-Newrelic-Id: VURQV1BZRkZdXUFT/, data
273
278
  end
274
279
 
275
280
  with_config(:"cross_application_tracer.enabled" => true) do
@@ -279,7 +284,11 @@ class NewRelic::Agent::Instrumentation::NetInstrumentationTest < Test::Unit::Tes
279
284
 
280
285
  def test_adds_a_request_header_to_outgoing_requests_if_old_xp_config_is_present
281
286
  @socket.check_write do |data|
282
- assert_match /(?i:x-newrelic-id): VURQV1BZRkZdXUFT/, data
287
+ # assert_match /(?i:x-newrelic-id): VURQV1BZRkZdXUFT/, data
288
+ # The above assertion won't work in Ruby 2.0.0-p0 because of a bug in the
289
+ # regexp engine. Until that's fixed we'll check the header name case
290
+ # sensitively.
291
+ assert_match /X-Newrelic-Id: VURQV1BZRkZdXUFT/, data
283
292
  end
284
293
 
285
294
  with_config(:cross_application_tracing => true) do
@@ -289,7 +298,11 @@ class NewRelic::Agent::Instrumentation::NetInstrumentationTest < Test::Unit::Tes
289
298
 
290
299
  def test_agent_doesnt_add_a_request_header_to_outgoing_requests_if_xp_disabled
291
300
  @socket.check_write do |data|
292
- assert_no_match /(?i:x-newrelic-id): VURQV1BZRkZdXUFT/, data
301
+ # assert_no_match /(?i:x-newrelic-id): VURQV1BZRkZdXUFT/, data
302
+ # The above assertion won't work in Ruby 2.0.0-p0 because of a bug in the
303
+ # regexp engine. Until that's fixed we'll check the header name case
304
+ # sensitively.
305
+ assert_no_match /X-Newrelic-Id: VURQV1BZRkZdXUFT/, data
293
306
  end
294
307
 
295
308
  Net::HTTP.get URI.parse('http://www.google.com/index.html')
@@ -79,6 +79,6 @@ class NewRelic::Agent::WorkerLoopTest < Test::Unit::TestCase
79
79
  end
80
80
 
81
81
  def ticks(start, finish, step)
82
- (start..finish).step(step).to_a
82
+ (start..finish).step(step).map{|i| Time.at(i)}
83
83
  end
84
84
  end
metadata CHANGED
@@ -1,8 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newrelic_rpm
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.8.64.beta
5
- prerelease: 9
4
+ version: 3.5.8.70
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jason Clark
@@ -41,7 +41,7 @@ cert_chain:
41
41
  cHUySWFQWE92bTNUOEc0TzZxWnZobkxoL1VpZW4rK0RqOGVGQmVjVFBvTThw
42
42
  VmpLM3BoNQpuL0V3dVpDY0U2Z2h0Q0NNCi0tLS0tRU5EIENFUlRJRklDQVRF
43
43
  LS0tLS0K
44
- date: 2013-02-26 00:00:00.000000000 Z
44
+ date: 2013-02-28 00:00:00.000000000 Z
45
45
  dependencies: []
46
46
  description: ! 'New Relic is a performance management system, developed by New Relic,
47
47
 
@@ -134,6 +134,8 @@ files:
134
134
  - lib/new_relic/agent/instrumentation/rails/errors.rb
135
135
  - lib/new_relic/agent/instrumentation/rails3/action_controller.rb
136
136
  - lib/new_relic/agent/instrumentation/rails3/errors.rb
137
+ - lib/new_relic/agent/instrumentation/rails4/action_controller.rb
138
+ - lib/new_relic/agent/instrumentation/rails4/errors.rb
137
139
  - lib/new_relic/agent/instrumentation/resque.rb
138
140
  - lib/new_relic/agent/instrumentation/sinatra.rb
139
141
  - lib/new_relic/agent/instrumentation/sunspot.rb
metadata.gz.sig CHANGED
Binary file