full_request_logger 0.3 → 0.3.1
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/Gemfile.lock +66 -66
- data/README.md +4 -4
- data/app/controllers/rails/conductor/full_request_logger/request_logs_controller.rb +2 -1
- data/app/views/rails/conductor/full_request_logger/request_logs/index.html.erb +3 -1
- data/full_request_logger.gemspec +2 -2
- data/lib/full_request_logger/engine.rb +7 -0
- data/lib/full_request_logger/job.rb +9 -0
- data/lib/full_request_logger/middleware.rb +1 -1
- data/lib/full_request_logger/processor.rb +5 -8
- data/test/processor_test.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c29787f9346418ef668cf13d447e5213744323c20a268af972ef5fd95420270c
|
4
|
+
data.tar.gz: 68477467205afbb579f81d122780eeca0240e8b2fa530673ad58ce2a7b9dd7f5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 503622938851c3ef75cdb957b7dfa4c54208f577b5d8e46f6dbb01cdbad30b29e17952c47287845f295d33b72ac096380955226fa8d0f8bd74ab7b330c849f57
|
7
|
+
data.tar.gz: e03156b8169140f7d72294c604848590bda8a5bacca7be04730f7b88c6697323b89ba26e75c34fd69dd8b97f6ce048661d0c474c85d4b2cb51220718aea3ca6d
|
data/Gemfile.lock
CHANGED
@@ -2,117 +2,117 @@ PATH
|
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
4
|
full_request_logger (0.3)
|
5
|
-
rails (>=
|
5
|
+
rails (>= 5.0.0)
|
6
6
|
redis (>= 4.0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
actioncable (6.0.
|
12
|
-
actionpack (= 6.0.
|
11
|
+
actioncable (6.0.2.2)
|
12
|
+
actionpack (= 6.0.2.2)
|
13
13
|
nio4r (~> 2.0)
|
14
14
|
websocket-driver (>= 0.6.1)
|
15
|
-
actionmailbox (6.0.
|
16
|
-
actionpack (= 6.0.
|
17
|
-
activejob (= 6.0.
|
18
|
-
activerecord (= 6.0.
|
19
|
-
activestorage (= 6.0.
|
20
|
-
activesupport (= 6.0.
|
15
|
+
actionmailbox (6.0.2.2)
|
16
|
+
actionpack (= 6.0.2.2)
|
17
|
+
activejob (= 6.0.2.2)
|
18
|
+
activerecord (= 6.0.2.2)
|
19
|
+
activestorage (= 6.0.2.2)
|
20
|
+
activesupport (= 6.0.2.2)
|
21
21
|
mail (>= 2.7.1)
|
22
|
-
actionmailer (6.0.
|
23
|
-
actionpack (= 6.0.
|
24
|
-
actionview (= 6.0.
|
25
|
-
activejob (= 6.0.
|
22
|
+
actionmailer (6.0.2.2)
|
23
|
+
actionpack (= 6.0.2.2)
|
24
|
+
actionview (= 6.0.2.2)
|
25
|
+
activejob (= 6.0.2.2)
|
26
26
|
mail (~> 2.5, >= 2.5.4)
|
27
27
|
rails-dom-testing (~> 2.0)
|
28
|
-
actionpack (6.0.
|
29
|
-
actionview (= 6.0.
|
30
|
-
activesupport (= 6.0.
|
31
|
-
rack (~> 2.0)
|
28
|
+
actionpack (6.0.2.2)
|
29
|
+
actionview (= 6.0.2.2)
|
30
|
+
activesupport (= 6.0.2.2)
|
31
|
+
rack (~> 2.0, >= 2.0.8)
|
32
32
|
rack-test (>= 0.6.3)
|
33
33
|
rails-dom-testing (~> 2.0)
|
34
34
|
rails-html-sanitizer (~> 1.0, >= 1.2.0)
|
35
|
-
actiontext (6.0.
|
36
|
-
actionpack (= 6.0.
|
37
|
-
activerecord (= 6.0.
|
38
|
-
activestorage (= 6.0.
|
39
|
-
activesupport (= 6.0.
|
35
|
+
actiontext (6.0.2.2)
|
36
|
+
actionpack (= 6.0.2.2)
|
37
|
+
activerecord (= 6.0.2.2)
|
38
|
+
activestorage (= 6.0.2.2)
|
39
|
+
activesupport (= 6.0.2.2)
|
40
40
|
nokogiri (>= 1.8.5)
|
41
|
-
actionview (6.0.
|
42
|
-
activesupport (= 6.0.
|
41
|
+
actionview (6.0.2.2)
|
42
|
+
activesupport (= 6.0.2.2)
|
43
43
|
builder (~> 3.1)
|
44
44
|
erubi (~> 1.4)
|
45
45
|
rails-dom-testing (~> 2.0)
|
46
46
|
rails-html-sanitizer (~> 1.1, >= 1.2.0)
|
47
|
-
activejob (6.0.
|
48
|
-
activesupport (= 6.0.
|
47
|
+
activejob (6.0.2.2)
|
48
|
+
activesupport (= 6.0.2.2)
|
49
49
|
globalid (>= 0.3.6)
|
50
|
-
activemodel (6.0.
|
51
|
-
activesupport (= 6.0.
|
52
|
-
activerecord (6.0.
|
53
|
-
activemodel (= 6.0.
|
54
|
-
activesupport (= 6.0.
|
55
|
-
activestorage (6.0.
|
56
|
-
actionpack (= 6.0.
|
57
|
-
activejob (= 6.0.
|
58
|
-
activerecord (= 6.0.
|
50
|
+
activemodel (6.0.2.2)
|
51
|
+
activesupport (= 6.0.2.2)
|
52
|
+
activerecord (6.0.2.2)
|
53
|
+
activemodel (= 6.0.2.2)
|
54
|
+
activesupport (= 6.0.2.2)
|
55
|
+
activestorage (6.0.2.2)
|
56
|
+
actionpack (= 6.0.2.2)
|
57
|
+
activejob (= 6.0.2.2)
|
58
|
+
activerecord (= 6.0.2.2)
|
59
59
|
marcel (~> 0.3.1)
|
60
|
-
activesupport (6.0.
|
60
|
+
activesupport (6.0.2.2)
|
61
61
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
62
62
|
i18n (>= 0.7, < 2)
|
63
63
|
minitest (~> 5.1)
|
64
64
|
tzinfo (~> 1.1)
|
65
|
-
zeitwerk (~> 2.
|
66
|
-
builder (3.2.
|
65
|
+
zeitwerk (~> 2.2)
|
66
|
+
builder (3.2.4)
|
67
67
|
byebug (11.0.1)
|
68
|
-
concurrent-ruby (1.1.
|
69
|
-
crass (1.0.
|
68
|
+
concurrent-ruby (1.1.6)
|
69
|
+
crass (1.0.6)
|
70
70
|
erubi (1.9.0)
|
71
71
|
globalid (0.4.2)
|
72
72
|
activesupport (>= 4.2.0)
|
73
|
-
i18n (1.
|
73
|
+
i18n (1.8.2)
|
74
74
|
concurrent-ruby (~> 1.0)
|
75
|
-
loofah (2.
|
75
|
+
loofah (2.4.0)
|
76
76
|
crass (~> 1.0.2)
|
77
77
|
nokogiri (>= 1.5.9)
|
78
78
|
mail (2.7.1)
|
79
79
|
mini_mime (>= 0.1.1)
|
80
80
|
marcel (0.3.3)
|
81
81
|
mimemagic (~> 0.3.2)
|
82
|
-
method_source (0.
|
83
|
-
mimemagic (0.3.
|
82
|
+
method_source (1.0.0)
|
83
|
+
mimemagic (0.3.4)
|
84
84
|
mini_mime (1.0.2)
|
85
85
|
mini_portile2 (2.4.0)
|
86
|
-
minitest (5.
|
86
|
+
minitest (5.14.0)
|
87
87
|
nio4r (2.5.2)
|
88
|
-
nokogiri (1.10.
|
88
|
+
nokogiri (1.10.9)
|
89
89
|
mini_portile2 (~> 2.4.0)
|
90
|
-
rack (2.
|
90
|
+
rack (2.2.2)
|
91
91
|
rack-test (1.1.0)
|
92
92
|
rack (>= 1.0, < 3)
|
93
|
-
rails (6.0.
|
94
|
-
actioncable (= 6.0.
|
95
|
-
actionmailbox (= 6.0.
|
96
|
-
actionmailer (= 6.0.
|
97
|
-
actionpack (= 6.0.
|
98
|
-
actiontext (= 6.0.
|
99
|
-
actionview (= 6.0.
|
100
|
-
activejob (= 6.0.
|
101
|
-
activemodel (= 6.0.
|
102
|
-
activerecord (= 6.0.
|
103
|
-
activestorage (= 6.0.
|
104
|
-
activesupport (= 6.0.
|
93
|
+
rails (6.0.2.2)
|
94
|
+
actioncable (= 6.0.2.2)
|
95
|
+
actionmailbox (= 6.0.2.2)
|
96
|
+
actionmailer (= 6.0.2.2)
|
97
|
+
actionpack (= 6.0.2.2)
|
98
|
+
actiontext (= 6.0.2.2)
|
99
|
+
actionview (= 6.0.2.2)
|
100
|
+
activejob (= 6.0.2.2)
|
101
|
+
activemodel (= 6.0.2.2)
|
102
|
+
activerecord (= 6.0.2.2)
|
103
|
+
activestorage (= 6.0.2.2)
|
104
|
+
activesupport (= 6.0.2.2)
|
105
105
|
bundler (>= 1.3.0)
|
106
|
-
railties (= 6.0.
|
106
|
+
railties (= 6.0.2.2)
|
107
107
|
sprockets-rails (>= 2.0.0)
|
108
108
|
rails-dom-testing (2.0.3)
|
109
109
|
activesupport (>= 4.2.0)
|
110
110
|
nokogiri (>= 1.6)
|
111
111
|
rails-html-sanitizer (1.3.0)
|
112
112
|
loofah (~> 2.3)
|
113
|
-
railties (6.0.
|
114
|
-
actionpack (= 6.0.
|
115
|
-
activesupport (= 6.0.
|
113
|
+
railties (6.0.2.2)
|
114
|
+
actionpack (= 6.0.2.2)
|
115
|
+
activesupport (= 6.0.2.2)
|
116
116
|
method_source
|
117
117
|
rake (>= 0.8.7)
|
118
118
|
thor (>= 0.20.3, < 2.0)
|
@@ -125,14 +125,14 @@ GEM
|
|
125
125
|
actionpack (>= 4.0)
|
126
126
|
activesupport (>= 4.0)
|
127
127
|
sprockets (>= 3.0.0)
|
128
|
-
thor (0.
|
128
|
+
thor (1.0.1)
|
129
129
|
thread_safe (0.3.6)
|
130
|
-
tzinfo (1.2.
|
130
|
+
tzinfo (1.2.6)
|
131
131
|
thread_safe (~> 0.1)
|
132
132
|
websocket-driver (0.7.1)
|
133
133
|
websocket-extensions (>= 0.1.0)
|
134
134
|
websocket-extensions (0.1.4)
|
135
|
-
zeitwerk (2.
|
135
|
+
zeitwerk (2.3.0)
|
136
136
|
|
137
137
|
PLATFORMS
|
138
138
|
ruby
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Full Request Logger
|
2
2
|
|
3
|
-
Easy access to full request logs via a web UI. The recorder attaches to the existing Rails.logger instance,
|
3
|
+
Easy access to full request logs via a web UI. The recorder attaches to the existing Rails.logger instance,
|
4
4
|
and captures a copy of each log line into a per-thread buffer. When the request is over, the middleware makes
|
5
5
|
the recorder store all the log lines that were recorded for that request as a compressed batch to an auto-expiring Redis key.
|
6
6
|
|
@@ -17,14 +17,14 @@ gem 'full_request_logger'
|
|
17
17
|
|
18
18
|
## Configuration
|
19
19
|
|
20
|
-
Add to development.rb and/or production.rb. Default time-to-live (TTL) for
|
20
|
+
Add to development.rb and/or production.rb. Default time-to-live (TTL) for each recorded request is 10 minutes,
|
21
21
|
and the default Redis storage is assumed to live on localhost, but both can be overwritten. Only configuration needed
|
22
22
|
is the enabled setting.
|
23
23
|
|
24
24
|
```ruby
|
25
25
|
config.full_request_logger.enabled = true
|
26
26
|
config.full_request_logger.ttl = 1.hour
|
27
|
-
config.full_request_logger.redis = { host: "127.0.0.1", port:
|
27
|
+
config.full_request_logger.redis = { host: "127.0.0.1", port: 6379, timeout: 1 }
|
28
28
|
```
|
29
29
|
|
30
30
|
You can restrict which requests will be stored by setting an eligibility function that gets to evaluate the request:
|
@@ -46,7 +46,7 @@ full_request_logger:
|
|
46
46
|
|
47
47
|
## Usage
|
48
48
|
|
49
|
-
Access request logs via `/rails/conductor/full_request_logger/request_logs
|
49
|
+
Access request logs via `/rails/conductor/full_request_logger/request_logs`.
|
50
50
|
|
51
51
|
## License
|
52
52
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
module Rails
|
2
2
|
class Conductor::FullRequestLogger::RequestLogsController < ActionController::Base
|
3
3
|
before_action :authenticate
|
4
|
+
skip_before_action :verify_authenticity_token, only: :create
|
4
5
|
|
5
6
|
layout "rails/conductor"
|
6
7
|
|
@@ -18,7 +19,7 @@ module Rails
|
|
18
19
|
format.text { send_data @logs, disposition: :attachment, filename: "#{params[:id]}.log" }
|
19
20
|
end
|
20
21
|
else
|
21
|
-
|
22
|
+
redirect_to rails_conductor_request_logs_url, alert: "Request not found!"
|
22
23
|
end
|
23
24
|
end
|
24
25
|
|
@@ -1,7 +1,9 @@
|
|
1
1
|
<h1>Lookup a request log</h1>
|
2
2
|
|
3
|
+
<% if alert = flash[:alert] %><p style="color: red"><%= alert %></p><% end %>
|
4
|
+
|
3
5
|
<%= form_with url: rails_conductor_request_logs_path do |form| %>
|
4
6
|
<p>Copy the X-Request-Id header and paste it in:</p>
|
5
|
-
<%= form.text_field :id, size: 40, placeholder: "0540689b-1ec6-4b92-ae8e-1c55bf7c3b79" %>
|
7
|
+
<%= form.text_field :id, size: 40, placeholder: "0540689b-1ec6-4b92-ae8e-1c55bf7c3b79", autofocus: true %>
|
6
8
|
<%= form.submit "Retrieve" %>
|
7
9
|
<% end %>
|
data/full_request_logger.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'full_request_logger'
|
3
|
-
s.version = '0.3'
|
3
|
+
s.version = '0.3.1'
|
4
4
|
s.authors = 'David Heinemeier Hansson'
|
5
5
|
s.email = 'david@basecamp.com'
|
6
6
|
s.summary = 'Make full request logs accessible via web UI'
|
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
|
|
9
9
|
|
10
10
|
s.required_ruby_version = '>= 2.6.0'
|
11
11
|
|
12
|
-
s.add_dependency 'rails', '>=
|
12
|
+
s.add_dependency 'rails', '>= 5.0.0'
|
13
13
|
s.add_dependency 'redis', '>= 4.0'
|
14
14
|
|
15
15
|
s.add_development_dependency 'bundler', '~> 1.17'
|
@@ -1,5 +1,6 @@
|
|
1
1
|
require "rails/engine"
|
2
2
|
require "full_request_logger/middleware"
|
3
|
+
require "full_request_logger/job"
|
3
4
|
|
4
5
|
module FullRequestLogger
|
5
6
|
class Engine < Rails::Engine
|
@@ -12,6 +13,12 @@ module FullRequestLogger
|
|
12
13
|
config.app_middleware.insert_after ::ActionDispatch::RequestId, FullRequestLogger::Middleware
|
13
14
|
end
|
14
15
|
|
16
|
+
initializer "full_request_logger.job" do
|
17
|
+
ActiveSupport.on_load(:active_job) do
|
18
|
+
include FullRequestLogger::Job
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
15
22
|
initializer "full_request_logger.configs" do
|
16
23
|
config.after_initialize do |app|
|
17
24
|
FullRequestLogger.enabled = app.config.full_request_logger.enabled || false
|
@@ -1,9 +1,8 @@
|
|
1
1
|
require "full_request_logger/recorder"
|
2
|
-
require "action_dispatch/http/request"
|
3
2
|
|
4
3
|
class FullRequestLogger::Processor
|
5
|
-
def initialize(
|
6
|
-
@
|
4
|
+
def initialize(request)
|
5
|
+
@request = request
|
7
6
|
end
|
8
7
|
|
9
8
|
def process
|
@@ -15,6 +14,9 @@ class FullRequestLogger::Processor
|
|
15
14
|
end
|
16
15
|
|
17
16
|
private
|
17
|
+
attr_reader :request
|
18
|
+
delegate :request_id, to: :request
|
19
|
+
|
18
20
|
def enabled?
|
19
21
|
FullRequestLogger.enabled
|
20
22
|
end
|
@@ -32,9 +34,4 @@ class FullRequestLogger::Processor
|
|
32
34
|
def recorder
|
33
35
|
@recorder ||= FullRequestLogger::Recorder.instance
|
34
36
|
end
|
35
|
-
|
36
|
-
delegate :request_id, to: :request
|
37
|
-
def request
|
38
|
-
@request ||= ActionDispatch::Request.new(@env)
|
39
|
-
end
|
40
37
|
end
|
data/test/processor_test.rb
CHANGED
@@ -11,7 +11,7 @@ class ProcessorTest < ActiveSupport::TestCase
|
|
11
11
|
FRL = FullRequestLogger::Recorder.instance.tap { |frl| frl.attach_to(LOGGER) }
|
12
12
|
|
13
13
|
setup do
|
14
|
-
@processor = FullRequestLogger::Processor.new({ "action_dispatch.request_id" => "123" })
|
14
|
+
@processor = FullRequestLogger::Processor.new(ActionDispatch::Request.new({ "action_dispatch.request_id" => "123" }))
|
15
15
|
end
|
16
16
|
|
17
17
|
teardown { FRL.clear_all }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: full_request_logger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 5.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 5.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: redis
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -71,6 +71,7 @@ files:
|
|
71
71
|
- full_request_logger.gemspec
|
72
72
|
- lib/full_request_logger.rb
|
73
73
|
- lib/full_request_logger/engine.rb
|
74
|
+
- lib/full_request_logger/job.rb
|
74
75
|
- lib/full_request_logger/middleware.rb
|
75
76
|
- lib/full_request_logger/processor.rb
|
76
77
|
- lib/full_request_logger/recorder.rb
|