dry-monitor 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +6 -0
- data/lib/dry/monitor/rack/logger.rb +2 -2
- data/lib/dry/monitor/version.rb +1 -1
- data/spec/integration/rack_middleware_spec.rb +35 -10
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ca2399eb8989f99e9840024b317599e731b2e357
|
4
|
+
data.tar.gz: 01e127fab50b60edcc4ac61846907341fd826e23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5175053c85e8ae01f9892a3e17fe3e2c54820379cfabde8624893ff35833d7aa9c34bc3c1bf741cab7be77fd519fd6c8bc825997934b58506a3769e63d3bc669
|
7
|
+
data.tar.gz: f01dc548ac3b1f02f72d6b5c7ed875b3100e86af9d6168be33b6910c1170979675cd4634e393dc41c53bc404ec947d2e3c38a11b3ae6d0e132b91298d62900fb
|
data/CHANGELOG.md
CHANGED
data/lib/dry/monitor/version.rb
CHANGED
@@ -17,13 +17,15 @@ RSpec.describe Dry::Monitor::Rack::Middleware do
|
|
17
17
|
Dry::Monitor::Rack::Logger.new(Dry::Monitor::Logger.new(log_file_path))
|
18
18
|
end
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
let(:env) do
|
21
|
+
{ 'REQUEST_METHOD' => 'GET',
|
22
|
+
'PATH_INFO' => '/hello-world',
|
23
|
+
'REMOTE_ADDR' => '0.0.0.0',
|
24
|
+
'QUERY_STRING' => query_params }
|
25
|
+
end
|
24
26
|
|
25
|
-
|
26
|
-
|
27
|
+
let(:query_params) do
|
28
|
+
%w[
|
27
29
|
_csrf=123456
|
28
30
|
password=secret
|
29
31
|
user[password]=secret
|
@@ -34,8 +36,9 @@ RSpec.describe Dry::Monitor::Rack::Middleware do
|
|
34
36
|
ids[]=1
|
35
37
|
ids[]=2
|
36
38
|
].join('&')
|
37
|
-
|
39
|
+
end
|
38
40
|
|
41
|
+
describe '#call' do
|
39
42
|
before do
|
40
43
|
File.open(log_file_path, 'w').close
|
41
44
|
rack_logger.attach(middleware)
|
@@ -62,12 +65,34 @@ RSpec.describe Dry::Monitor::Rack::Middleware do
|
|
62
65
|
captured = []
|
63
66
|
|
64
67
|
middleware.on(:error) do |event|
|
65
|
-
captured << event
|
68
|
+
captured << event[:exception]
|
69
|
+
captured << event[:env]
|
66
70
|
end
|
67
71
|
|
68
|
-
|
72
|
+
exception = 'oops'
|
73
|
+
env = { 'REQUEST_METHOD' => 'GET' }
|
74
|
+
|
75
|
+
middleware.instrument(:error, exception: exception, env: env)
|
76
|
+
|
77
|
+
expect(captured).to eql([exception, env])
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
describe 'rack logger' do
|
82
|
+
before do
|
83
|
+
File.open(log_file_path, 'w').close
|
84
|
+
rack_logger.attach(middleware)
|
85
|
+
end
|
86
|
+
|
87
|
+
it 'logs exceptions' do
|
88
|
+
exception = double(:exception, message: 'oops', backtrace: ['/some/path.rb'])
|
89
|
+
|
90
|
+
middleware.instrument(:error, exception: exception, env: env)
|
91
|
+
|
92
|
+
log_file_content = File.read(log_file_path)
|
69
93
|
|
70
|
-
expect(
|
94
|
+
expect(log_file_content).to include('oops')
|
95
|
+
expect(log_file_content).to include('/some/path.rb')
|
71
96
|
end
|
72
97
|
end
|
73
98
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dry-monitor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Piotr Solnica
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01-
|
11
|
+
date: 2018-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rouge
|
@@ -168,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
168
|
version: '0'
|
169
169
|
requirements: []
|
170
170
|
rubyforge_project:
|
171
|
-
rubygems_version: 2.
|
171
|
+
rubygems_version: 2.6.11
|
172
172
|
signing_key:
|
173
173
|
specification_version: 4
|
174
174
|
summary: Monitoring and instrumentation APIs
|