rack-instruments 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/rack/instruments.rb +11 -12
  2. metadata +2 -2
@@ -9,8 +9,7 @@ module Rack
9
9
  def initialize(app, options={})
10
10
  @app = app
11
11
 
12
- @context = (options[:context] || {}).
13
- map { |k, v| [k, v] }
12
+ @context = options[:context]
14
13
  @header_request_ids = options.fetch(:header_request_ids, true)
15
14
  @ignore_extensions = options.fetch(:ignore_extensions,
16
15
  %w{css gif ico jpg js jpeg pdf png})
@@ -38,17 +37,17 @@ module Rack
38
37
  env["REQUEST_IDS"] = request_ids
39
38
  end
40
39
 
41
- data = [
42
- [:method, env["REQUEST_METHOD"]],
43
- [:path, env["REQUEST_PATH"]],
44
- [:ip, env["X-FORWARDED-FOR"] || env["HTTP_X_FORWARDED_FOR"] ||
45
- env["REMOTE_ADDR"]],
46
- [:status, lambda { status }],
47
- ]
48
- data += request_ids.map { |id| [:id, id] }
49
- data += @context if @context
40
+ data = {
41
+ method: env["REQUEST_METHOD"],
42
+ path: env["REQUEST_PATH"],
43
+ id: request_ids.join(","),
44
+ ip: env["X-FORWARDED-FOR"] || env["HTTP_X_FORWARDED_FOR"] ||
45
+ env["REMOTE_ADDR"],
46
+ status: lambda { status },
47
+ }
48
+ data.merge!(@context) if @context
50
49
 
51
- Slides.log_array(:instrumentation, data) do
50
+ Slides.log(:instrumentation, data) do
52
51
  status, headers, response = @app.call(env)
53
52
  end
54
53
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-instruments
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-28 00:00:00.000000000 Z
12
+ date: 2013-03-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: slides