newrelic_rpm 2.13.5.beta1 → 2.13.5.beta2

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/CHANGELOG CHANGED
@@ -6,6 +6,7 @@ v2.13.5
6
6
  * Sequel instrumentation from Aman Gupta
7
7
  * patches to 1.9 compatibility from dkastner on github
8
8
  * Support for 1.9.2's garbage collection instrumentation from Justin Weiss
9
+ * On Heroku, existing queue time headers will be detected
9
10
 
10
11
  v2.13.4
11
12
  * Update DNS lookup code to remove hardcoded IP addresses
@@ -7,6 +7,7 @@ module NewRelic
7
7
  MIDDLEWARE_HEADER = 'HTTP_X_MIDDLEWARE_START'
8
8
  QUEUE_HEADER = 'HTTP_X_QUEUE_START'
9
9
  ALT_QUEUE_HEADER = 'HTTP_X_QUEUE_TIME'
10
+ HEROKU_QUEUE_HEADER = 'HTTP_X_HEROKU_QUEUE_WAIT_TIME'
10
11
  APP_HEADER = 'HTTP_X_APPLICATION_START'
11
12
 
12
13
  HEADER_REGEX = /([^\s\/,(t=)]+)? ?t=([0-9]+)/
@@ -77,11 +78,19 @@ module NewRelic
77
78
  end
78
79
 
79
80
  def check_for_alternate_queue_length(env)
81
+ heroku_length = check_for_heroku_queue_length(env)
82
+ return heroku_length if heroku_length
80
83
  header = env[ALT_QUEUE_HEADER]
81
84
  return nil unless header
82
85
  (header.gsub('t=', '').to_i / 1_000_000.0)
83
86
  end
84
87
 
88
+ def check_for_heroku_queue_length(env)
89
+ header = env[HEROKU_QUEUE_HEADER]
90
+ return nil unless header
91
+ (header.gsub(/[^0-9]/, '').to_i / 1_000.0)
92
+ end
93
+
85
94
  def get_matches_from_header(header, env)
86
95
  return [] if env.nil?
87
96
  get_matches(env[header]).map do |name, time|
@@ -4,7 +4,7 @@ module NewRelic
4
4
  MAJOR = 2
5
5
  MINOR = 13
6
6
  TINY = 5
7
- BUILD = 'beta1' #'0' # Set to nil for a release, 'beta1', 'alpha', etc for prerelease builds
7
+ BUILD = 'beta2' #'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/newrelic_rpm.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{newrelic_rpm}
8
- s.version = "2.13.5.beta1"
8
+ s.version = "2.13.5.beta2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Bill Kayser", "Justin George"]
@@ -164,6 +164,43 @@ class NewRelic::Agent::Instrumentation::QueueTimeTest < Test::Unit::TestCase
164
164
  check_metric_time('WebFrontend/QueueTime', 1.0, 0.001)
165
165
  end
166
166
 
167
+ def test_check_for_alternate_queue_length_override
168
+ env = {}
169
+ create_test_start_time(env)
170
+ env['HTTP_X_QUEUE_START'] = 't=1' # obviously incorrect
171
+ env['HTTP_X_QUEUE_TIME'] = '1000000'
172
+ assert_calls_metrics('WebFrontend/QueueTime') do
173
+ parse_queue_time_from(env)
174
+ end
175
+
176
+ # alternate queue should override normal header
177
+ check_metric_time('WebFrontend/QueueTime', 1.0, 0.001)
178
+ end
179
+
180
+ def test_check_for_heroku_queue_length
181
+ env = {}
182
+ create_test_start_time(env)
183
+ env['HTTP_X_HEROKU_QUEUE_WAIT_TIME'] = '1000'
184
+ assert_calls_metrics('WebFrontend/QueueTime') do
185
+ parse_queue_time_from(env)
186
+ end
187
+
188
+ check_metric_time('WebFrontend/QueueTime', 1.0, 0.001)
189
+ end
190
+
191
+ def test_check_for_heroku_queue_length_override
192
+ env = {}
193
+ create_test_start_time(env)
194
+ env['HTTP_X_QUEUE_TIME'] = '10000000' # ten MEEELION useconds
195
+ env['HTTP_X_HEROKU_QUEUE_WAIT_TIME'] = '1000'
196
+ assert_calls_metrics('WebFrontend/QueueTime') do
197
+ parse_queue_time_from(env)
198
+ end
199
+
200
+ # heroku queue should override alternate queue
201
+ check_metric_time('WebFrontend/QueueTime', 1.0, 0.001)
202
+ end
203
+
167
204
  # each server should be one second, and the total would be 2 seconds
168
205
  def test_record_individual_server_stats
169
206
  matches = [['foo', Time.at(1000)], ['bar', Time.at(1001)]]
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: newrelic_rpm
3
3
  version: !ruby/object:Gem::Version
4
- hash: 62196249
4
+ hash: 62196255
5
5
  prerelease: 7
6
6
  segments:
7
7
  - 2
8
8
  - 13
9
9
  - 5
10
10
  - beta
11
- - 1
12
- version: 2.13.5.beta1
11
+ - 2
12
+ version: 2.13.5.beta2
13
13
  platform: ruby
14
14
  authors:
15
15
  - Bill Kayser