right_support 2.9.2 → 2.9.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e2215ed9e7706511edfcd6ea56abf45486749d9d
4
- data.tar.gz: 15fac74e4fcb14b20b32f4de9a6087388bf3310b
3
+ metadata.gz: 37afc64ef433ebff859d8ceee0fb88c158609480
4
+ data.tar.gz: cee57ea2de6dca374c35df0337af297192d01176
5
5
  SHA512:
6
- metadata.gz: 0bae6ef9d208192d1a73104c5f1178895ea3b27b09cbc09f84f017d2849c0f66a8b2c81959c52a3d7f0988575b77be9cd2065b2a3ab4d770852da45c9229de29
7
- data.tar.gz: 4de8efb3cfd6d0c76c16875749fb681a3909c6ee6f6bf5fb1d3f7399c02039bdccfa547ea2460cbf824bc26ba6a99be51288ac609c7e2177e5ffa37590a70eea
6
+ metadata.gz: 27c7985c33dca1f7a28b811ea02849d93b1ecc53feecbb83e7e08594bb1008e1d31ca3a8d7f0910892235a4b01be62fd37342673ca2462e172f3dcb2321af6b0
7
+ data.tar.gz: 9a30f91c3411fa31619b67f24f6bd8611b7fc1e7fe28c2cb0f90e39bdbec6094624b6463ee519bd9e0e556775f6c32917449e58f9879beb76a11902660cdd4e5
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.9.2
1
+ 2.9.3
@@ -76,7 +76,7 @@ module RightSupport::Rack
76
76
  if env['sinatra.error'] && !env['sinatra.error.handled']
77
77
  log_exception(logger, env['sinatra.error'])
78
78
  end
79
- log_request_end(logger, status, header, body, began_at) if enabled
79
+ log_request_end(logger, env, status, header, body, began_at) if enabled
80
80
 
81
81
  return [status, header, body]
82
82
  rescue Exception => e
@@ -117,8 +117,11 @@ module RightSupport::Rack
117
117
  #
118
118
  # @return [TrueClass] always true
119
119
  def log_request_begin(logger, env)
120
- # Assuming remote addresses are IPv4, make them all align to the same width
121
- remote_addr = env['HTTP_X_FORWARDED_FOR'] || env["REMOTE_ADDR"] || "-"
120
+ # Assuming remote addresses are IPv4, make them all align to the same
121
+ # width
122
+ remote_addr = env['HTP_X_REAL_IP'] ||
123
+ env['HTTP_X_FORWARDED_FOR'] ||
124
+ env["REMOTE_ADDR"] || "-"
122
125
  remote_addr = remote_addr.ljust(15)
123
126
 
124
127
  # If we're not logging the contents of the query string we only log the fact that a query
@@ -142,16 +145,16 @@ module RightSupport::Rack
142
145
  shard_info = 'Shard: ' + (env['HTTP_X_SHARD'] || 'default').to_s + ';'
143
146
 
144
147
  params = [
145
- env["REQUEST_METHOD"],
146
- env["PATH_INFO"],
148
+ env['REQUEST_METHOD'],
149
+ env['PATH_INFO'],
147
150
  query_info,
148
151
  remote_addr,
149
152
  sess,
150
153
  shard_info,
151
- env["rack.request_uuid"] || ''
154
+ env['rack.request_uuid'] || ''
152
155
  ]
153
156
 
154
- logger.info %Q{Processing %s "%s%s" (for %s) %s %s Request ID: %s} % params
157
+ logger.info 'Processing %s "%s%s" (for %s) %s %s Request ID: %s' % params
155
158
  end
156
159
 
157
160
  # Log end of request
@@ -162,7 +165,7 @@ module RightSupport::Rack
162
165
  # @param [Time] began_at time of the Rack request beginning
163
166
  #
164
167
  # @return [TrueClass] always true
165
- def log_request_end(logger, status, headers, body, began_at)
168
+ def log_request_end(logger, env, status, headers, body, began_at)
166
169
  duration = (Time.now - began_at) * 1000
167
170
 
168
171
  # Downcase keys in the headers Hash for case-insensitive comparisons
@@ -184,9 +187,10 @@ module RightSupport::Rack
184
187
  duration,
185
188
  "#{status} #{Rack::Utils::HTTP_STATUS_CODES[status]}",
186
189
  content_length.to_s,
190
+ env['rack.request_uuid'] || ''
187
191
  ]
188
192
 
189
- logger.info %Q{Completed in %dms | %s | %s bytes} % params
193
+ logger.info 'Completed in %dms | %s | %s bytes | Request ID: %s' % params
190
194
  end
191
195
 
192
196
  # Log exception
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: right_support 2.9.2 ruby lib
5
+ # stub: right_support 2.9.3 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "right_support"
9
- s.version = "2.9.2"
9
+ s.version = "2.9.3"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Tony Spataro", "Sergey Sergyenko", "Ryan Williamson", "Lee Kirchhoff", "Alexey Karpik", "Scott Messier"]
14
- s.date = "2015-10-09"
14
+ s.date = "2015-11-02"
15
15
  s.description = "A toolkit of useful, reusable foundation code created by RightScale."
16
16
  s.email = "support@rightscale.com"
17
17
  s.extra_rdoc_files = [
@@ -141,5 +141,21 @@ describe RightSupport::Rack::RequestLogger do
141
141
  end
142
142
  end
143
143
 
144
+ context 'request ID logging' do
145
+ before(:each) do
146
+ @logger = mock_logger
147
+ @env['rack.request_uuid'] = 'some-uuid'
148
+ end
149
+
150
+ it 'tags the Processing line' do
151
+ @logger.should_receive(:info).with(FlexMock.on { |arg| arg.should =~ /Request ID: some-uuid/ } )
152
+ @middleware.send(:log_request_begin, @logger, @env)
153
+ end
154
+
155
+ it 'tags the Completed line' do
156
+ @logger.should_receive(:info).with(FlexMock.on { |arg| arg.should =~ /Request ID: some-uuid/ } )
157
+ @middleware.send(:log_request_end, @logger, @env, 200, {}, '', Time.now)
158
+ end
159
+ end
144
160
  end
145
161
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: right_support
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.2
4
+ version: 2.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Spataro
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2015-10-09 00:00:00.000000000 Z
16
+ date: 2015-11-03 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: rake