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.
- data/lib/rack/instruments.rb +11 -12
- metadata +2 -2
data/lib/rack/instruments.rb
CHANGED
@@ -9,8 +9,7 @@ module Rack
|
|
9
9
|
def initialize(app, options={})
|
10
10
|
@app = app
|
11
11
|
|
12
|
-
@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
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
data
|
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.
|
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.
|
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-
|
12
|
+
date: 2013-03-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: slides
|