moesif_rack 1.4.10 → 1.4.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +1 -1
- data/lib/moesif_rack/app_config.rb +2 -2
- data/lib/moesif_rack/moesif_middleware.rb +6 -2
- data/moesif_capture_outgoing/httplog/adapters/net_http.rb +2 -2
- data/test/moesif_rack_test.rb +4 -3
- metadata +14 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9533c0d146d3b8f0b3a6f8b5edf0f9cda27e7207fb34d92f7c24f07b33a4d38
|
4
|
+
data.tar.gz: 233466faadd9f15e6bf22a65b3995a78c5eb9a752bf36c743440ad094486dc28
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0236b79eb83085bfe54cca228792267031bea3edc6aa71cb556adef68ff46143c4087035396c8698b6502f7b93137444dd6a5337a060c9777b5e6933f4352af2
|
7
|
+
data.tar.gz: '08bfc8a7fe975f9f6d5992a4bcf4b761852c361b30882577dc8e031cb066f78c5735cae1ba5315e4725623385cec5a6ebb057a48e1b67ea86dd327db25c754b8'
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -529,7 +529,7 @@ response = MoesifRack::MoesifMiddleware.new(@app, @options).update_companies_bat
|
|
529
529
|
1. Manually clone the git repo
|
530
530
|
2. From terminal/cmd navigate to the root directory of the middleware.
|
531
531
|
3. Invoke 'gem install moesif_rack'
|
532
|
-
4. Add your own application id to 'test/moesif_rack_test.rb'. You can find your Application Id from [_Moesif Dashboard_](https://www.moesif.com/) ->
|
532
|
+
4. Add your own application id to 'test/moesif_rack_test.rb'. You can find your Application Id from [_Moesif Dashboard_](https://www.moesif.com/) -> _Bottom Left Menu_ -> _Installation_
|
533
533
|
5. Invoke 'ruby test/moesif_rack_test.rb'
|
534
534
|
6. Invoke 'ruby -I test test/moesif_rack_test.rb -n test_capture_outgoing' to test capturing outgoing API calls from your app to third parties like Stripe, Github or to your own dependencies.
|
535
535
|
|
@@ -45,13 +45,13 @@ class AppConfig
|
|
45
45
|
else
|
46
46
|
@helpers.log_debug 'Response body is nil, assuming default behavior'
|
47
47
|
# Response body is nil, so assuming default behavior
|
48
|
-
return nil,
|
48
|
+
return nil, nil, Time.now.utc
|
49
49
|
end
|
50
50
|
rescue => exception
|
51
51
|
@helpers.log_debug 'Error while parsing the configuration object, assuming default behavior'
|
52
52
|
@helpers.log_debug exception.to_s
|
53
53
|
# Assuming default behavior
|
54
|
-
return nil,
|
54
|
+
return nil, nil, Time.now.utc
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
@@ -156,17 +156,20 @@ module MoesifRack
|
|
156
156
|
end
|
157
157
|
|
158
158
|
def call env
|
159
|
-
start_time = Time.now.utc.iso8601
|
159
|
+
start_time = Time.now.utc.iso8601(3)
|
160
160
|
|
161
161
|
@helpers.log_debug('Calling Moesif middleware')
|
162
162
|
|
163
163
|
status, headers, body = @app.call env
|
164
|
-
end_time = Time.now.utc.iso8601
|
164
|
+
end_time = Time.now.utc.iso8601(3)
|
165
165
|
|
166
166
|
process_send = lambda do
|
167
167
|
req = Rack::Request.new(env)
|
168
168
|
complex_copy = env.dup
|
169
169
|
|
170
|
+
# Filter hash to only have keys of type string
|
171
|
+
complex_copy = complex_copy.select { |k, v| k.is_a? String }
|
172
|
+
|
170
173
|
req_headers = {}
|
171
174
|
complex_copy.select {|k,v| k.start_with?('HTTP_', 'CONTENT_') }.each do |key, val|
|
172
175
|
new_key = key.sub(/^HTTP_/, '')
|
@@ -336,6 +339,7 @@ module MoesifRack
|
|
336
339
|
rescue => exception
|
337
340
|
@helpers.log_debug 'Error while logging event - '
|
338
341
|
@helpers.log_debug exception.to_s
|
342
|
+
@helpers.log_debug exception.backtrace
|
339
343
|
end
|
340
344
|
end
|
341
345
|
|
@@ -7,7 +7,7 @@ module Net
|
|
7
7
|
def request(request, body = nil, &block)
|
8
8
|
|
9
9
|
# Request Start Time
|
10
|
-
request_time = Time.now.utc.iso8601
|
10
|
+
request_time = Time.now.utc.iso8601(3)
|
11
11
|
|
12
12
|
# URL
|
13
13
|
url = "https://#{@address}#{request.path}"
|
@@ -16,7 +16,7 @@ module Net
|
|
16
16
|
@response = orig_request(request, body, &block)
|
17
17
|
|
18
18
|
# Response Time
|
19
|
-
response_time = Time.now.utc.iso8601
|
19
|
+
response_time = Time.now.utc.iso8601(3)
|
20
20
|
|
21
21
|
# Log Event to Moesif
|
22
22
|
if started?
|
data/test/moesif_rack_test.rb
CHANGED
@@ -46,7 +46,7 @@ class MoesifRackTest < Test::Unit::TestCase
|
|
46
46
|
}
|
47
47
|
}
|
48
48
|
@moesif_rack_app = MoesifRack::MoesifMiddleware.new(@app, @options)
|
49
|
-
@app_config = AppConfig.new
|
49
|
+
@app_config = AppConfig.new(true)
|
50
50
|
end
|
51
51
|
|
52
52
|
def test_capture_outgoing
|
@@ -116,8 +116,9 @@ class MoesifRackTest < Test::Unit::TestCase
|
|
116
116
|
def test_get_config
|
117
117
|
@api_client = MoesifApi::MoesifAPIClient.new(@options['application_id'])
|
118
118
|
@api_controller = @api_client.api
|
119
|
-
@config = @app_config.get_config(@api_controller
|
120
|
-
@
|
119
|
+
@config = @app_config.get_config(@api_controller)
|
120
|
+
@config_body, @config_etag, @last_updated_time = @app_config.parse_configuration(@config)
|
121
|
+
@sampling_percentage = @app_config.get_sampling_percentage(@config_body, nil, nil)
|
121
122
|
assert_operator 100, :>=, @sampling_percentage
|
122
123
|
end
|
123
124
|
|
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.4.
|
4
|
+
version: 1.4.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Moesif, Inc
|
@@ -9,48 +9,42 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-02-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
+
name: test-unit
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
16
17
|
requirements:
|
17
18
|
- - "~>"
|
18
19
|
- !ruby/object:Gem::Version
|
19
|
-
version: '3.
|
20
|
+
version: '3.5'
|
20
21
|
- - ">="
|
21
22
|
- !ruby/object:Gem::Version
|
22
|
-
version: 3.
|
23
|
-
name: test-unit
|
24
|
-
prerelease: false
|
23
|
+
version: 3.5.0
|
25
24
|
type: :development
|
25
|
+
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
27
27
|
requirements:
|
28
28
|
- - "~>"
|
29
29
|
- !ruby/object:Gem::Version
|
30
|
-
version: '3.
|
30
|
+
version: '3.5'
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 3.
|
33
|
+
version: 3.5.0
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
|
+
name: moesif_api
|
35
36
|
requirement: !ruby/object:Gem::Requirement
|
36
37
|
requirements:
|
37
38
|
- - "~>"
|
38
39
|
- !ruby/object:Gem::Version
|
39
|
-
version:
|
40
|
-
- - ">="
|
41
|
-
- !ruby/object:Gem::Version
|
42
|
-
version: 1.2.12
|
43
|
-
name: moesif_api
|
44
|
-
prerelease: false
|
40
|
+
version: 1.2.14
|
45
41
|
type: :runtime
|
42
|
+
prerelease: false
|
46
43
|
version_requirements: !ruby/object:Gem::Requirement
|
47
44
|
requirements:
|
48
45
|
- - "~>"
|
49
46
|
- !ruby/object:Gem::Version
|
50
|
-
version:
|
51
|
-
- - ">="
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: 1.2.12
|
47
|
+
version: 1.2.14
|
54
48
|
description: Rack/Rails middleware to log API calls to Moesif API analytics and monitoring
|
55
49
|
email: xing@moesif.com
|
56
50
|
executables: []
|
@@ -87,7 +81,7 @@ require_paths:
|
|
87
81
|
- lib
|
88
82
|
required_ruby_version: !ruby/object:Gem::Requirement
|
89
83
|
requirements:
|
90
|
-
- - "
|
84
|
+
- - ">="
|
91
85
|
- !ruby/object:Gem::Version
|
92
86
|
version: '2.0'
|
93
87
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
@@ -96,8 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
96
90
|
- !ruby/object:Gem::Version
|
97
91
|
version: '0'
|
98
92
|
requirements: []
|
99
|
-
|
100
|
-
rubygems_version: 2.7.10
|
93
|
+
rubygems_version: 3.1.6
|
101
94
|
signing_key:
|
102
95
|
specification_version: 4
|
103
96
|
summary: moesif_rack
|