active_record_query_trace 1.8.1 → 1.8.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_record_query_trace/version.rb +1 -1
- data/lib/active_record_query_trace.rb +8 -12
- metadata +50 -35
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38fca2a7c8ab8c844aa4000782195d30cce4264c1d161712c8550e5f92894973
|
4
|
+
data.tar.gz: 946ab1bee79c23ac3c23f50b1ebddb9999ef010c4ffe8fac236e610383055d0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ba1638c78ac6e5f6c36772f4e3682889b03b3d0f2ac2bc4d4facfe85b4f853ea6dd06fee729e86935841a720c3432b707636dfd65a762b0925b08f652ef8366
|
7
|
+
data.tar.gz: 419760a7c5c944d80e1b98b9d93344aa84495d018da6d6483e2787b8c865a1883a0769887ac4015d0b4261fdd8def690d4dded6aadb33e5e0057a27ff7ccb8cd
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'active_record/log_subscriber'
|
4
|
+
require_relative 'active_record_query_trace/version'
|
4
5
|
|
5
6
|
module ActiveRecordQueryTrace
|
6
7
|
INDENTATION = ' ' * 6
|
@@ -26,12 +27,7 @@ module ActiveRecordQueryTrace
|
|
26
27
|
}.freeze
|
27
28
|
|
28
29
|
class << self
|
29
|
-
attr_accessor :enabled
|
30
|
-
attr_accessor :lines
|
31
|
-
attr_accessor :ignore_cached_queries
|
32
|
-
attr_accessor :colorize
|
33
|
-
attr_accessor :query_type
|
34
|
-
attr_accessor :suppress_logging_of_db_reads
|
30
|
+
attr_accessor :enabled, :lines, :ignore_cached_queries, :colorize, :query_type, :suppress_logging_of_db_reads
|
35
31
|
attr_writer :default_cleaner
|
36
32
|
attr_reader :backtrace_cleaner, :level
|
37
33
|
|
@@ -77,7 +73,7 @@ module ActiveRecordQueryTrace
|
|
77
73
|
# This cannot be set in a constant as Rails.root is not yet available when
|
78
74
|
# this file is loaded.
|
79
75
|
def rails_root_regexp
|
80
|
-
@rails_root_regexp ||= %r{#{Regexp.escape(Rails.root.to_s)}(
|
76
|
+
@rails_root_regexp ||= %r{#{Regexp.escape(Rails.root.to_s)}(?!/vendor)}
|
81
77
|
end
|
82
78
|
end
|
83
79
|
|
@@ -97,7 +93,7 @@ module ActiveRecordQueryTrace
|
|
97
93
|
payload = event.payload
|
98
94
|
return unless display_backtrace?(payload)
|
99
95
|
trace = fully_formatted_trace # Memoize
|
100
|
-
debug(trace)
|
96
|
+
debug(trace) if trace.present?
|
101
97
|
end
|
102
98
|
|
103
99
|
delegate :default_cleaner, to: ActiveRecordQueryTrace
|
@@ -128,7 +124,7 @@ module ActiveRecordQueryTrace
|
|
128
124
|
when :write then !db_read_query?(payload)
|
129
125
|
else
|
130
126
|
raise 'Invalid ActiveRecordQueryTrace.query_type value ' \
|
131
|
-
|
127
|
+
"#{ActiveRecordQueryTrace.level}. Should be :all, :read, or :write."
|
132
128
|
end
|
133
129
|
end
|
134
130
|
|
@@ -139,7 +135,7 @@ module ActiveRecordQueryTrace
|
|
139
135
|
def fully_formatted_trace
|
140
136
|
cleaned_trace = clean_trace(original_trace)
|
141
137
|
return if cleaned_trace.blank?
|
142
|
-
stringified_trace = BACKTRACE_PREFIX + lines_to_display(cleaned_trace).join("\n"
|
138
|
+
stringified_trace = BACKTRACE_PREFIX + lines_to_display(cleaned_trace).join("\n#{INDENTATION}")
|
143
139
|
colorize_text(stringified_trace)
|
144
140
|
end
|
145
141
|
|
@@ -207,7 +203,7 @@ module ActiveRecordQueryTrace
|
|
207
203
|
def validate_color_code(color_code)
|
208
204
|
valid_color_code?(color_code) || raise(
|
209
205
|
'ActiveRecordQueryTrace.colorize was set to an invalid ' \
|
210
|
-
|
206
|
+
"color. Use one of #{COLORS.keys} or a valid color code."
|
211
207
|
)
|
212
208
|
end
|
213
209
|
|
@@ -241,7 +237,7 @@ ActiveSupport::LogSubscriber.class_eval do
|
|
241
237
|
|
242
238
|
def debug(*args, &block)
|
243
239
|
return if ActiveRecordQueryTrace.suppress_logging_of_db_reads \
|
244
|
-
&& args.first !~ /INSERT|UPDATE|DELETE|#{ActiveRecordQueryTrace::BACKTRACE_PREFIX}/
|
240
|
+
&& args.first !~ /INSERT|UPDATE|DELETE|#{ActiveRecordQueryTrace::BACKTRACE_PREFIX}/o
|
245
241
|
original_debug(*args, &block)
|
246
242
|
end
|
247
243
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_record_query_trace
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.8.
|
4
|
+
version: 1.8.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cody Caughlan
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2025-01-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -17,112 +17,126 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
21
|
-
type: :
|
20
|
+
version: 6.0.0
|
21
|
+
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
27
|
+
version: 6.0.0
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
|
-
name:
|
29
|
+
name: rake
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version:
|
34
|
+
version: '13.0'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
41
|
+
version: '13.0'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
|
-
name:
|
43
|
+
name: debug
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version:
|
48
|
+
version: '1.8'
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version:
|
55
|
+
version: '1.8'
|
56
56
|
- !ruby/object:Gem::Dependency
|
57
57
|
name: rspec
|
58
58
|
requirement: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- - "
|
60
|
+
- - "~>"
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: 3.
|
62
|
+
version: '3.12'
|
63
63
|
type: :development
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
|
-
- - "
|
67
|
+
- - "~>"
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 3.
|
69
|
+
version: '3.12'
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: rubocop
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
73
73
|
requirements:
|
74
|
-
- - "
|
74
|
+
- - "~>"
|
75
75
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
76
|
+
version: '1.55'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
79
|
version_requirements: !ruby/object:Gem::Requirement
|
80
80
|
requirements:
|
81
|
-
- - "
|
81
|
+
- - "~>"
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version:
|
83
|
+
version: '1.55'
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
|
-
name: rubocop-
|
85
|
+
name: rubocop-performance
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
|
-
- - "
|
88
|
+
- - "~>"
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version: 1.
|
90
|
+
version: '1.18'
|
91
91
|
type: :development
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- - "
|
95
|
+
- - "~>"
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version: 1.
|
97
|
+
version: '1.18'
|
98
98
|
- !ruby/object:Gem::Dependency
|
99
|
-
name:
|
99
|
+
name: rubocop-rails
|
100
100
|
requirement: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
|
-
- - "
|
102
|
+
- - "~>"
|
103
103
|
- !ruby/object:Gem::Version
|
104
|
-
version:
|
104
|
+
version: '2.20'
|
105
105
|
type: :development
|
106
106
|
prerelease: false
|
107
107
|
version_requirements: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
|
-
- - "
|
109
|
+
- - "~>"
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '2.20'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: rubocop-rspec
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - "~>"
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '2.22'
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - "~>"
|
110
124
|
- !ruby/object:Gem::Version
|
111
|
-
version:
|
125
|
+
version: '2.22'
|
112
126
|
- !ruby/object:Gem::Dependency
|
113
|
-
name:
|
127
|
+
name: simplecov
|
114
128
|
requirement: !ruby/object:Gem::Requirement
|
115
129
|
requirements:
|
116
130
|
- - ">="
|
117
131
|
- !ruby/object:Gem::Version
|
118
|
-
version:
|
132
|
+
version: 0.22.0
|
119
133
|
type: :development
|
120
134
|
prerelease: false
|
121
135
|
version_requirements: !ruby/object:Gem::Requirement
|
122
136
|
requirements:
|
123
137
|
- - ">="
|
124
138
|
- !ruby/object:Gem::Version
|
125
|
-
version:
|
139
|
+
version: 0.22.0
|
126
140
|
description: Print stack trace of all DB queries to the Rails log. Helpful to find
|
127
141
|
where queries are being executed in your application.
|
128
142
|
email: bruno@facca.info
|
@@ -135,7 +149,8 @@ files:
|
|
135
149
|
homepage: https://github.com/brunofacca/active-record-query-trace
|
136
150
|
licenses:
|
137
151
|
- MIT
|
138
|
-
metadata:
|
152
|
+
metadata:
|
153
|
+
homepage_uri: https://github.com/brunofacca/active-record-query-trace
|
139
154
|
post_install_message:
|
140
155
|
rdoc_options: []
|
141
156
|
require_paths:
|
@@ -144,10 +159,10 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
144
159
|
requirements:
|
145
160
|
- - ">="
|
146
161
|
- !ruby/object:Gem::Version
|
147
|
-
version: '2.
|
162
|
+
version: '2.7'
|
148
163
|
- - "<"
|
149
164
|
- !ruby/object:Gem::Version
|
150
|
-
version: '
|
165
|
+
version: '3.5'
|
151
166
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
167
|
requirements:
|
153
168
|
- - ">="
|