moesif_rack 1.3.4 → 1.3.5

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
  SHA256:
3
- metadata.gz: 78140d9557e785d6def875ef2ff36d1966fc322f0b50f54840e9489bafa1f03d
4
- data.tar.gz: f3b9000be0288be9f9bc786a1072cdaf09a15bbbc7e99720f39479098a468ff3
3
+ metadata.gz: c829d3004e26c40536debc186d0c45a8a3cf08d854c75f0cf76dce20d142e951
4
+ data.tar.gz: ac8c4d6c2c66dae5348b7421128fdd6b5ce0b2c9a48e1712aa632817f2ade291
5
5
  SHA512:
6
- metadata.gz: 87afa9da20ecade3ea36a3dd9791f2d7d68245db9838f287eacd5905c2230ed0736237bd320a934186c84760fa658575d05eac9538d5b37903e99207e59defcc
7
- data.tar.gz: 17752a036f01c4b26949a71a6856d29d5e89beb3e818859c22df8a20a01eeaae291d19a7b52805cd93d55a4bf246ce832c98cdaef4e4e317a97ae1b7abf858d5
6
+ metadata.gz: 7f10f8c2e8c4cb8af3d55a4d5aee69626ddb893405ba866578af506834516848b5367f5361a07ca5eb6acb3adccae2a8429432d8792cfb197391b42db310dab6
7
+ data.tar.gz: 3ee6984671ab33f20dcf4b6b640935e315cc84c68e39bb9093b77a9e632aa3683e0e213d197140baa93f76f14809e0d19f701710900f0edc1e9575182121c27f
data/README.md CHANGED
@@ -46,11 +46,26 @@ and then clicking _Installation_.
46
46
 
47
47
  ### Add to middleware
48
48
 
49
- within `config/application.rb`
49
+ Using strings or symbols for middleware class names is deprecated for newer frameworks like Ruby 5.0,
50
+ so you should pass the class directly.
51
+
52
+ #### For Rails 5.0 or newer:
50
53
 
51
54
  ```ruby
55
+ class Application < Rails::Application
56
+ # snip
52
57
 
58
+ config.middleware.use MoesifRack::MoesifMiddleware, moesif_options
53
59
 
60
+ # snip
61
+ end
62
+ ```
63
+
64
+ #### For other frameworks:
65
+
66
+ within `config/application.rb`
67
+
68
+ ```ruby
54
69
  class Application < Rails::Application
55
70
  # snip
56
71
 
@@ -58,35 +73,37 @@ within `config/application.rb`
58
73
 
59
74
  # snip
60
75
  end
61
-
62
76
  ```
63
77
 
64
78
  #### Order of Middleware Matters
65
79
 
66
- Since Moesif Rack is basically a logging middleware, the ordering of middleware matters for accuracy and completeness.
67
- Many middlewares are installed by default by Rails.
80
+ Since Moesif Rack is a logging middleware, the ordering of middleware matters for accuracy and data collection.
81
+ Many middleware are installed by default by Rails.
68
82
 
69
- To see the list of middlewares that your system already have, type this into the bash.
70
-
71
- ```bash
72
- bin/rails middleware
73
- ```
74
-
75
- The best place for "MoesifRack::MoesifMidleware" is on top as possible (so it captures the data closest to the wire).
83
+ The best place for "MoesifRack::MoesifMidleware" is on top (so it captures the data closest to the wire).
76
84
  Typically, right above the default logger of Rails apps, "Rails::Rack::Logger" is a good spot.
77
85
  Or if you want to be as close as wire as possible, put it before "ActionDispatch::Static"
78
86
 
79
- You should use the following line of code to insert the middleware into the right spot.
87
+ To insert the Moesif middleware before "Rails::Rack::Logger", you can use the `insert_before` method instead of
88
+ `use`
80
89
 
81
90
  ```ruby
91
+ class Application < Rails::Application
92
+ # snip
82
93
 
83
- config.middleware.insert_before "Rails::Rack::Logger", "MoesifRack::MoesifMiddleware", moesif_options
94
+ config.middleware.insert_before Rails::Rack::Logger, MoesifRack::MoesifMiddleware, moesif_options
84
95
 
96
+ # snip
97
+ end
85
98
  ```
99
+ If you are using "Rack::Deflater" or other compression middleware, make sure Moesif is after
100
+ it, so it can capture the uncompressed data.
86
101
 
87
- Please note, if you are using "Rack::Deflater" please make sure that "MoesifRack::MoesifMiddlware"
88
- is below it, so it can capture uncompressed data.
102
+ To see your current list of middleware:
89
103
 
104
+ ```bash
105
+ bin/rails middleware
106
+ ```
90
107
 
91
108
  ## Configuration options
92
109
 
@@ -285,7 +285,7 @@ module MoesifRack
285
285
 
286
286
  def get_response_body(response)
287
287
  body = response.respond_to?(:body) ? response.body : response
288
- body = body.inject("") { |i, a| i << a } if body.respond_to?(:each)
288
+ body = body.inject("") { |i, a| i << a } if (body.respond_to?(:each) && body.respond_to?(:inject))
289
289
  body.to_s
290
290
  end
291
291
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moesif_rack
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.4
4
+ version: 1.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Moesif, Inc
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-08-22 00:00:00.000000000 Z
12
+ date: 2019-10-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: test-unit
@@ -75,7 +75,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  requirements: []
78
- rubygems_version: 3.0.1
78
+ rubyforge_project:
79
+ rubygems_version: 2.7.7
79
80
  signing_key:
80
81
  specification_version: 4
81
82
  summary: moesif_rack