moesif_rack 1.3.4 → 1.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +32 -15
- data/lib/moesif_rack/moesif_middleware.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c829d3004e26c40536debc186d0c45a8a3cf08d854c75f0cf76dce20d142e951
|
4
|
+
data.tar.gz: ac8c4d6c2c66dae5348b7421128fdd6b5ce0b2c9a48e1712aa632817f2ade291
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
67
|
-
Many
|
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
|
-
|
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
|
-
|
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
|
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
|
-
|
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
|
+
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-
|
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
|
-
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 2.7.7
|
79
80
|
signing_key:
|
80
81
|
specification_version: 4
|
81
82
|
summary: moesif_rack
|