log_sanity 2.1.2 → 2.2.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3c28332ecf2daf12ad4b7f43fe6e322b22db9d3988d6a386a863bcfb23079c72
4
- data.tar.gz: '0789db0e2dee84e0248a950e999a1d48dfc4aea1f9650ae45b873ddf4982ba57'
3
+ metadata.gz: 334adfd10ad13c52b7a3e24973adb808447737f1f7099576aac44b21c871df46
4
+ data.tar.gz: dcfab6f923a4d6ccce9d57f57c10c8b883ff4729a2e36fa977be03c58f631487
5
5
  SHA512:
6
- metadata.gz: 56788f3c81a6337cecaf2a710bc41cf8c9430b5f57ce4ae5483b296b3ab9059ab574c0b089eb338cf91333379ecce4418d86c4836eed87bd5b7823511cd17b78
7
- data.tar.gz: a05e761fb82ef26f6c02a3d1e99ada217a275f171ea2fa8317e84a0d2c6f26f0e42e185192433a412520394e7d2eb747c26f96c4711d97996058111bb453dc66
6
+ metadata.gz: 0776a645c92e2fcc3bb17c1df01b364c5ad070690c388628060461a8a1c1880cee6bfa5605eb53d24443bbdec853407bb3f9ebafbc76a7b799cd3278bf3c2eb9
7
+ data.tar.gz: a964344a187aaccc49c3eda2dddd8f17077541b9b836eb836507cda7980c608818510e3e6330df1d51602d27fe7e7c1b46b50d456e92b4296033173a77167dde
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ #### 2.2.0
2
+
3
+ - Add DB query counts for ActiveRecord 7.2
4
+ Only real queries are reported; cached queries are excluded
5
+
1
6
  #### 2.1.2
2
7
 
3
8
  - In ActiveJob logs, output gid:// when available instead of using .to_json
data/Gemfile.lock CHANGED
@@ -1,103 +1,100 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- log_sanity (2.1.2)
5
- rails (>= 7.1.2, < 7.2)
4
+ log_sanity (2.2.0)
5
+ rails (>= 7.1.2, < 7.3)
6
6
 
7
7
  GEM
8
8
  remote: https://rubygems.org/
9
9
  specs:
10
- actioncable (7.1.3.2)
11
- actionpack (= 7.1.3.2)
12
- activesupport (= 7.1.3.2)
10
+ actioncable (7.2.1)
11
+ actionpack (= 7.2.1)
12
+ activesupport (= 7.2.1)
13
13
  nio4r (~> 2.0)
14
14
  websocket-driver (>= 0.6.1)
15
15
  zeitwerk (~> 2.6)
16
- actionmailbox (7.1.3.2)
17
- actionpack (= 7.1.3.2)
18
- activejob (= 7.1.3.2)
19
- activerecord (= 7.1.3.2)
20
- activestorage (= 7.1.3.2)
21
- activesupport (= 7.1.3.2)
22
- mail (>= 2.7.1)
23
- net-imap
24
- net-pop
25
- net-smtp
26
- actionmailer (7.1.3.2)
27
- actionpack (= 7.1.3.2)
28
- actionview (= 7.1.3.2)
29
- activejob (= 7.1.3.2)
30
- activesupport (= 7.1.3.2)
31
- mail (~> 2.5, >= 2.5.4)
32
- net-imap
33
- net-pop
34
- net-smtp
16
+ actionmailbox (7.2.1)
17
+ actionpack (= 7.2.1)
18
+ activejob (= 7.2.1)
19
+ activerecord (= 7.2.1)
20
+ activestorage (= 7.2.1)
21
+ activesupport (= 7.2.1)
22
+ mail (>= 2.8.0)
23
+ actionmailer (7.2.1)
24
+ actionpack (= 7.2.1)
25
+ actionview (= 7.2.1)
26
+ activejob (= 7.2.1)
27
+ activesupport (= 7.2.1)
28
+ mail (>= 2.8.0)
35
29
  rails-dom-testing (~> 2.2)
36
- actionpack (7.1.3.2)
37
- actionview (= 7.1.3.2)
38
- activesupport (= 7.1.3.2)
30
+ actionpack (7.2.1)
31
+ actionview (= 7.2.1)
32
+ activesupport (= 7.2.1)
39
33
  nokogiri (>= 1.8.5)
40
34
  racc
41
- rack (>= 2.2.4)
35
+ rack (>= 2.2.4, < 3.2)
42
36
  rack-session (>= 1.0.1)
43
37
  rack-test (>= 0.6.3)
44
38
  rails-dom-testing (~> 2.2)
45
39
  rails-html-sanitizer (~> 1.6)
46
- actiontext (7.1.3.2)
47
- actionpack (= 7.1.3.2)
48
- activerecord (= 7.1.3.2)
49
- activestorage (= 7.1.3.2)
50
- activesupport (= 7.1.3.2)
40
+ useragent (~> 0.16)
41
+ actiontext (7.2.1)
42
+ actionpack (= 7.2.1)
43
+ activerecord (= 7.2.1)
44
+ activestorage (= 7.2.1)
45
+ activesupport (= 7.2.1)
51
46
  globalid (>= 0.6.0)
52
47
  nokogiri (>= 1.8.5)
53
- actionview (7.1.3.2)
54
- activesupport (= 7.1.3.2)
48
+ actionview (7.2.1)
49
+ activesupport (= 7.2.1)
55
50
  builder (~> 3.1)
56
51
  erubi (~> 1.11)
57
52
  rails-dom-testing (~> 2.2)
58
53
  rails-html-sanitizer (~> 1.6)
59
- activejob (7.1.3.2)
60
- activesupport (= 7.1.3.2)
54
+ activejob (7.2.1)
55
+ activesupport (= 7.2.1)
61
56
  globalid (>= 0.3.6)
62
- activemodel (7.1.3.2)
63
- activesupport (= 7.1.3.2)
64
- activerecord (7.1.3.2)
65
- activemodel (= 7.1.3.2)
66
- activesupport (= 7.1.3.2)
57
+ activemodel (7.2.1)
58
+ activesupport (= 7.2.1)
59
+ activerecord (7.2.1)
60
+ activemodel (= 7.2.1)
61
+ activesupport (= 7.2.1)
67
62
  timeout (>= 0.4.0)
68
- activestorage (7.1.3.2)
69
- actionpack (= 7.1.3.2)
70
- activejob (= 7.1.3.2)
71
- activerecord (= 7.1.3.2)
72
- activesupport (= 7.1.3.2)
63
+ activestorage (7.2.1)
64
+ actionpack (= 7.2.1)
65
+ activejob (= 7.2.1)
66
+ activerecord (= 7.2.1)
67
+ activesupport (= 7.2.1)
73
68
  marcel (~> 1.0)
74
- activesupport (7.1.3.2)
69
+ activesupport (7.2.1)
75
70
  base64
76
71
  bigdecimal
77
- concurrent-ruby (~> 1.0, >= 1.0.2)
72
+ concurrent-ruby (~> 1.0, >= 1.3.1)
78
73
  connection_pool (>= 2.2.5)
79
74
  drb
80
75
  i18n (>= 1.6, < 2)
76
+ logger (>= 1.4.2)
81
77
  minitest (>= 5.1)
82
- mutex_m
83
- tzinfo (~> 2.0)
78
+ securerandom (>= 0.3)
79
+ tzinfo (~> 2.0, >= 2.0.5)
84
80
  base64 (0.2.0)
85
- bigdecimal (3.1.7)
86
- builder (3.2.4)
87
- concurrent-ruby (1.2.3)
81
+ bigdecimal (3.1.8)
82
+ builder (3.3.0)
83
+ concurrent-ruby (1.3.4)
88
84
  connection_pool (2.4.1)
89
85
  crass (1.0.6)
90
86
  date (3.3.4)
91
87
  drb (2.2.1)
92
- erubi (1.12.0)
88
+ erubi (1.13.0)
93
89
  globalid (1.2.1)
94
90
  activesupport (>= 6.1)
95
- i18n (1.14.4)
91
+ i18n (1.14.6)
96
92
  concurrent-ruby (~> 1.0)
97
93
  io-console (0.7.2)
98
- irb (1.13.0)
94
+ irb (1.14.0)
99
95
  rdoc (>= 4.0.0)
100
96
  reline (>= 0.4.2)
97
+ logger (1.6.1)
101
98
  loofah (2.22.0)
102
99
  crass (~> 1.0.2)
103
100
  nokogiri (>= 1.12.0)
@@ -108,28 +105,26 @@ GEM
108
105
  net-smtp
109
106
  marcel (1.0.4)
110
107
  mini_mime (1.1.5)
111
- minitest (5.22.3)
112
- mutex_m (0.2.0)
113
- net-imap (0.4.10)
108
+ minitest (5.25.1)
109
+ net-imap (0.4.16)
114
110
  date
115
111
  net-protocol
116
112
  net-pop (0.1.2)
117
- net-protocol
118
113
  net-protocol (0.2.2)
119
114
  timeout
120
115
  net-smtp (0.5.0)
121
116
  net-protocol
122
- nio4r (2.7.1)
123
- nokogiri (1.16.4-arm64-darwin)
117
+ nio4r (2.7.3)
118
+ nokogiri (1.16.7-arm64-darwin)
124
119
  racc (~> 1.4)
125
- nokogiri (1.16.4-x86_64-darwin)
120
+ nokogiri (1.16.7-x86_64-darwin)
126
121
  racc (~> 1.4)
127
- nokogiri (1.16.4-x86_64-linux)
122
+ nokogiri (1.16.7-x86_64-linux)
128
123
  racc (~> 1.4)
129
124
  psych (5.1.2)
130
125
  stringio
131
- racc (1.7.3)
132
- rack (3.0.10)
126
+ racc (1.8.1)
127
+ rack (3.1.7)
133
128
  rack-session (2.0.0)
134
129
  rack (>= 3.0.0)
135
130
  rack-test (2.1.0)
@@ -137,20 +132,20 @@ GEM
137
132
  rackup (2.1.0)
138
133
  rack (>= 3)
139
134
  webrick (~> 1.8)
140
- rails (7.1.3.2)
141
- actioncable (= 7.1.3.2)
142
- actionmailbox (= 7.1.3.2)
143
- actionmailer (= 7.1.3.2)
144
- actionpack (= 7.1.3.2)
145
- actiontext (= 7.1.3.2)
146
- actionview (= 7.1.3.2)
147
- activejob (= 7.1.3.2)
148
- activemodel (= 7.1.3.2)
149
- activerecord (= 7.1.3.2)
150
- activestorage (= 7.1.3.2)
151
- activesupport (= 7.1.3.2)
135
+ rails (7.2.1)
136
+ actioncable (= 7.2.1)
137
+ actionmailbox (= 7.2.1)
138
+ actionmailer (= 7.2.1)
139
+ actionpack (= 7.2.1)
140
+ actiontext (= 7.2.1)
141
+ actionview (= 7.2.1)
142
+ activejob (= 7.2.1)
143
+ activemodel (= 7.2.1)
144
+ activerecord (= 7.2.1)
145
+ activestorage (= 7.2.1)
146
+ activesupport (= 7.2.1)
152
147
  bundler (>= 1.15.0)
153
- railties (= 7.1.3.2)
148
+ railties (= 7.2.1)
154
149
  rails-dom-testing (2.2.0)
155
150
  activesupport (>= 5.0.0)
156
151
  minitest
@@ -158,29 +153,31 @@ GEM
158
153
  rails-html-sanitizer (1.6.0)
159
154
  loofah (~> 2.21)
160
155
  nokogiri (~> 1.14)
161
- railties (7.1.3.2)
162
- actionpack (= 7.1.3.2)
163
- activesupport (= 7.1.3.2)
164
- irb
156
+ railties (7.2.1)
157
+ actionpack (= 7.2.1)
158
+ activesupport (= 7.2.1)
159
+ irb (~> 1.13)
165
160
  rackup (>= 1.0.0)
166
161
  rake (>= 12.2)
167
162
  thor (~> 1.0, >= 1.2.2)
168
163
  zeitwerk (~> 2.6)
169
164
  rake (13.2.1)
170
- rdoc (6.6.3.1)
165
+ rdoc (6.7.0)
171
166
  psych (>= 4.0.0)
172
- reline (0.5.5)
167
+ reline (0.5.10)
173
168
  io-console (~> 0.5)
174
- stringio (3.1.0)
175
- thor (1.3.1)
169
+ securerandom (0.3.1)
170
+ stringio (3.1.1)
171
+ thor (1.3.2)
176
172
  timeout (0.4.1)
177
173
  tzinfo (2.0.6)
178
174
  concurrent-ruby (~> 1.0)
175
+ useragent (0.16.10)
179
176
  webrick (1.8.1)
180
177
  websocket-driver (0.7.6)
181
178
  websocket-extensions (>= 0.1.0)
182
179
  websocket-extensions (0.1.5)
183
- zeitwerk (2.6.13)
180
+ zeitwerk (2.6.18)
184
181
 
185
182
  PLATFORMS
186
183
  arm64-darwin
@@ -191,4 +188,4 @@ DEPENDENCIES
191
188
  log_sanity!
192
189
 
193
190
  BUNDLED WITH
194
- 2.4.10
191
+ 2.5.11
@@ -23,14 +23,24 @@ module LogSanity
23
23
  end
24
24
 
25
25
  durations = {'total' => event.duration.round}
26
+ queries = {}
26
27
  additions = ::ActionController::Base.log_process_action(payload)
27
28
  additions.each do |add|
28
29
  if add =~ /^([^:]+):?\s*([0-9.]+)(ms)?/
29
30
  ms = $2.to_f.round
30
- durations[$1.downcase] = ms if ms > 0
31
+ name = $1.downcase
32
+ durations[name] = ms if ms > 0
33
+ end
34
+ if name and add =~ /[^0-9]([0-9]+) quer/
35
+ q_real = $1.to_i
36
+ if q_real > 0 and add =~ /[^0-9]([0-9]+) cached/
37
+ q_real -= $1.to_i # exclude cached queries
38
+ end
39
+ queries[name] = q_real if q_real > 0
31
40
  end
32
41
  end
33
42
 
43
+ log 'queries', queries if queries.any?
34
44
  log 'duration', durations
35
45
  log 'status', status
36
46
  end
@@ -1,3 +1,3 @@
1
1
  module LogSanity
2
- VERSION = '2.1.2'
2
+ VERSION = '2.2.0'
3
3
  end
data/log_sanity.gemspec CHANGED
@@ -17,5 +17,5 @@ Gem::Specification.new do |s|
17
17
  s.test_files = s.files.grep(%r{^(test|spec|features)/})
18
18
  s.require_paths = ["lib"]
19
19
 
20
- s.add_dependency 'rails', '>= 7.1.2', '< 7.2'
20
+ s.add_dependency 'rails', '>= 7.1.2', '< 7.3'
21
21
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: log_sanity
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.2
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - thomas morgan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-04 00:00:00.000000000 Z
11
+ date: 2024-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: 7.1.2
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '7.2'
22
+ version: '7.3'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: 7.1.2
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '7.2'
32
+ version: '7.3'
33
33
  description: LogSanity - Bring sanity to Rails logs by reducing verbosity, using json
34
34
  output, and more.
35
35
  email:
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  - !ruby/object:Gem::Version
122
122
  version: '0'
123
123
  requirements: []
124
- rubygems_version: 3.5.9
124
+ rubygems_version: 3.5.11
125
125
  signing_key:
126
126
  specification_version: 4
127
127
  summary: LogSanity - Bring sanity to Rails logs