query_track 0.0.7 → 0.0.8
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/CHANGELOG.md +4 -0
- data/Gemfile.lock +8 -6
- data/README.md +12 -1
- data/lib/query_track/event_processor.rb +11 -3
- data/lib/query_track/settings.rb +2 -0
- data/lib/query_track/version.rb +1 -1
- data/lib/subscriber.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 11eafb45e2ddc8bb353f21db9208a07f66cca5ebc089985ca4521a5560f7fcfb
|
|
4
|
+
data.tar.gz: fb7b68d7a32a8c28b8554009e18b39f681b922ead72052c842e7d14dfd937359
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c63eb4682ce2bf6fc7f174a7bb6b6983bec52e6ed5c174a309dbe73aa9cda1b251f079b455edb0e7f56a0e853c9850ee3841667c73649fb000373ca73daf0139
|
|
7
|
+
data.tar.gz: 60a112cc30412a12293ed6f52923b101e951488719227802d1794a43b39fae7c2de6bc56550a8d3eca32bc6a3ecd4d4fee75ad696297103fe53dc1aa6371ea3b
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
query_track (0.0.
|
|
4
|
+
query_track (0.0.8)
|
|
5
5
|
activesupport
|
|
6
6
|
dry-configurable
|
|
7
7
|
slack_hook
|
|
@@ -9,11 +9,12 @@ PATH
|
|
|
9
9
|
GEM
|
|
10
10
|
remote: https://rubygems.org/
|
|
11
11
|
specs:
|
|
12
|
-
activesupport (
|
|
12
|
+
activesupport (6.0.0)
|
|
13
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
|
14
14
|
i18n (>= 0.7, < 2)
|
|
15
15
|
minitest (~> 5.1)
|
|
16
16
|
tzinfo (~> 1.1)
|
|
17
|
+
zeitwerk (~> 2.1, >= 2.1.8)
|
|
17
18
|
ast (2.4.0)
|
|
18
19
|
byebug (11.0.1)
|
|
19
20
|
concurrent-ruby (1.1.5)
|
|
@@ -21,17 +22,17 @@ GEM
|
|
|
21
22
|
dry-configurable (0.8.3)
|
|
22
23
|
concurrent-ruby (~> 1.0)
|
|
23
24
|
dry-core (~> 0.4, >= 0.4.7)
|
|
24
|
-
dry-core (0.4.
|
|
25
|
+
dry-core (0.4.9)
|
|
25
26
|
concurrent-ruby (~> 1.0)
|
|
26
27
|
i18n (1.6.0)
|
|
27
28
|
concurrent-ruby (~> 1.0)
|
|
28
|
-
jaro_winkler (1.5.
|
|
29
|
+
jaro_winkler (1.5.3)
|
|
29
30
|
minitest (5.11.3)
|
|
30
31
|
parallel (1.17.0)
|
|
31
32
|
parser (2.6.3.0)
|
|
32
33
|
ast (~> 2.4.0)
|
|
33
34
|
rainbow (3.0.0)
|
|
34
|
-
rake (12.3.
|
|
35
|
+
rake (12.3.3)
|
|
35
36
|
rspec (3.8.0)
|
|
36
37
|
rspec-core (~> 3.8.0)
|
|
37
38
|
rspec-expectations (~> 3.8.0)
|
|
@@ -45,7 +46,7 @@ GEM
|
|
|
45
46
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
46
47
|
rspec-support (~> 3.8.0)
|
|
47
48
|
rspec-support (3.8.2)
|
|
48
|
-
rubocop (0.
|
|
49
|
+
rubocop (0.74.0)
|
|
49
50
|
jaro_winkler (~> 1.5.1)
|
|
50
51
|
parallel (~> 1.10)
|
|
51
52
|
parser (>= 2.6)
|
|
@@ -58,6 +59,7 @@ GEM
|
|
|
58
59
|
tzinfo (1.2.5)
|
|
59
60
|
thread_safe (~> 0.1)
|
|
60
61
|
unicode-display_width (1.6.0)
|
|
62
|
+
zeitwerk (2.1.9)
|
|
61
63
|
|
|
62
64
|
PLATFORMS
|
|
63
65
|
ruby
|
data/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
[](https://circleci.com/gh/kirillshevch/query_track)
|
|
5
5
|
[](https://codeclimate.com/github/kirillshevch/query_track/maintainability)
|
|
6
6
|
|
|
7
|
-
Tool for finding time-consuming database queries for ActiveRecord-based Rails Apps. Provides Slack notifications
|
|
7
|
+
Tool for finding time-consuming database queries for ActiveRecord-based Rails Apps. Provides Slack notifications with backtrace, raw SQL, time duration, etc.
|
|
8
8
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
@@ -59,6 +59,17 @@ QueryTrack::Settings.configure do |config|
|
|
|
59
59
|
end
|
|
60
60
|
```
|
|
61
61
|
|
|
62
|
+
### Enable/Disable toggle
|
|
63
|
+
|
|
64
|
+
Enable/disable with ENV variables to turn it on/off without code push. By default *QueryTrack* is enabled.
|
|
65
|
+
|
|
66
|
+
```ruby
|
|
67
|
+
QueryTrack::Settings.configure do |config|
|
|
68
|
+
config.duration = 0.5
|
|
69
|
+
config.enabled = ENV['QUERY_TRACK_ENABLED']
|
|
70
|
+
end
|
|
71
|
+
```
|
|
72
|
+
|
|
62
73
|
### Slack Notifications
|
|
63
74
|
|
|
64
75
|
To receive notifications about slow queries into Slack, you need to install [incoming-webhooks](https://reflow-files.slack.com/apps/A0F7XDUAZ-incoming-webhooks) and put link into config file:
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
module QueryTrack
|
|
2
2
|
class EventProcessor
|
|
3
|
-
attr_reader :event
|
|
3
|
+
attr_reader :event, :subscriber
|
|
4
4
|
|
|
5
|
-
def initialize(event)
|
|
5
|
+
def initialize(event, subscriber)
|
|
6
6
|
@event = event
|
|
7
|
+
@subscriber = subscriber
|
|
7
8
|
end
|
|
8
9
|
|
|
9
10
|
def call
|
|
10
|
-
|
|
11
|
+
unsubscribe
|
|
12
|
+
return unless QueryTrack::Settings.config.duration && QueryTrack::Settings.config.enabled
|
|
11
13
|
|
|
12
14
|
return if under_filter?(caller)
|
|
13
15
|
|
|
@@ -19,6 +21,12 @@ module QueryTrack
|
|
|
19
21
|
|
|
20
22
|
private
|
|
21
23
|
|
|
24
|
+
def unsubscribe
|
|
25
|
+
return if QueryTrack::Settings.config.enabled
|
|
26
|
+
|
|
27
|
+
ActiveSupport::Notifications.unsubscribe(subscriber)
|
|
28
|
+
end
|
|
29
|
+
|
|
22
30
|
def duration_seconds
|
|
23
31
|
event.duration / 1000
|
|
24
32
|
end
|
data/lib/query_track/settings.rb
CHANGED
data/lib/query_track/version.rb
CHANGED
data/lib/subscriber.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
ActiveSupport::Notifications.subscribe('sql.active_record') do |*args|
|
|
1
|
+
subscriber = ActiveSupport::Notifications.subscribe('sql.active_record') do |*args|
|
|
2
2
|
event = ActiveSupport::Notifications::Event.new(*args)
|
|
3
3
|
|
|
4
|
-
QueryTrack::EventProcessor.new(event).call
|
|
4
|
+
QueryTrack::EventProcessor.new(event, subscriber).call
|
|
5
5
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: query_track
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.8
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kirill Shevchenko
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-08-
|
|
11
|
+
date: 2019-08-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activesupport
|