awesome_explain 0.3.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/mongodb.yml +53 -0
  3. data/.github/workflows/postgres.yml +56 -0
  4. data/.gitignore +11 -0
  5. data/Appraisals +11 -0
  6. data/Gemfile.lock +209 -49
  7. data/LICENSE.txt +4 -20
  8. data/README.md +155 -7
  9. data/Rakefile +35 -1
  10. data/app/models/awesome_explain/application_record.rb +5 -0
  11. data/app/models/awesome_explain/controller.rb +20 -0
  12. data/app/models/awesome_explain/delayed_job.rb +7 -0
  13. data/app/models/awesome_explain/explain.rb +23 -0
  14. data/app/models/awesome_explain/log.rb +7 -0
  15. data/app/models/awesome_explain/pg_dml_stat.rb +4 -0
  16. data/app/models/awesome_explain/pg_seq_scan.rb +4 -0
  17. data/app/models/awesome_explain/plan_node.rb +52 -0
  18. data/app/models/awesome_explain/plan_tree.rb +66 -0
  19. data/app/models/awesome_explain/sidekiq_worker.rb +7 -0
  20. data/app/models/awesome_explain/sql_explain.rb +14 -0
  21. data/app/models/awesome_explain/sql_plan_node.rb +73 -0
  22. data/app/models/awesome_explain/sql_plan_stats.rb +34 -0
  23. data/app/models/awesome_explain/sql_plan_tree.rb +133 -0
  24. data/app/models/awesome_explain/sql_query.rb +7 -0
  25. data/app/models/awesome_explain/stacktrace.rb +11 -0
  26. data/awesome_explain.gemspec +16 -5
  27. data/bin/rails +14 -0
  28. data/data/mongodb/customers.bson +0 -0
  29. data/data/mongodb/customers.metadata.json +1 -0
  30. data/data/mongodb/line_items.bson +0 -0
  31. data/data/mongodb/line_items.metadata.json +1 -0
  32. data/data/mongodb/orders.bson +0 -0
  33. data/data/mongodb/orders.metadata.json +1 -0
  34. data/data/mongodb/products.bson +0 -0
  35. data/data/mongodb/products.metadata.json +1 -0
  36. data/data/postgresql/dvdrental.tar +0 -0
  37. data/db/migrate/20200507214801_stacktraces.rb +12 -0
  38. data/db/migrate/20200507214949_controllers.rb +16 -0
  39. data/db/migrate/20200507215205_logs.rb +22 -0
  40. data/db/migrate/20200507215243_explains.rb +27 -0
  41. data/gemfiles/rails_4.gemfile +7 -0
  42. data/gemfiles/rails_4.gemfile.lock +208 -0
  43. data/gemfiles/rails_5.gemfile +7 -0
  44. data/gemfiles/rails_5.gemfile.lock +209 -0
  45. data/gemfiles/rails_6.gemfile +7 -0
  46. data/gemfiles/rails_6.gemfile.lock +233 -0
  47. data/images/universe.png +0 -0
  48. data/lib/awesome_explain.rb +79 -2
  49. data/lib/awesome_explain/config.rb +196 -0
  50. data/lib/awesome_explain/engine.rb +5 -0
  51. data/lib/awesome_explain/insights/active_record_insights.rb +137 -0
  52. data/lib/awesome_explain/insights/base.rb +18 -0
  53. data/lib/awesome_explain/insights/mongoid_insights.rb +44 -0
  54. data/lib/awesome_explain/insights/sql_plans_insights.rb +64 -0
  55. data/lib/awesome_explain/kernel.rb +17 -0
  56. data/lib/awesome_explain/mongodb/base.rb +4 -0
  57. data/lib/awesome_explain/mongodb/command_start.rb +84 -0
  58. data/lib/awesome_explain/mongodb/command_success.rb +58 -0
  59. data/lib/awesome_explain/mongodb/formatter.rb +62 -0
  60. data/lib/awesome_explain/mongodb/helpers.rb +71 -0
  61. data/lib/awesome_explain/queue/command.rb +17 -0
  62. data/lib/awesome_explain/queue/simple_queue.rb +88 -0
  63. data/lib/awesome_explain/renderers/active_record.rb +114 -0
  64. data/lib/awesome_explain/renderers/base.rb +2 -0
  65. data/lib/awesome_explain/renderers/mongoid.rb +20 -33
  66. data/lib/awesome_explain/sidekiq_middleware.rb +17 -0
  67. data/lib/awesome_explain/stats/postgresql.rb +54 -0
  68. data/lib/awesome_explain/subscribers/active_record_passive_subscriber.rb +82 -0
  69. data/lib/awesome_explain/subscribers/active_record_subscriber.rb +187 -0
  70. data/lib/awesome_explain/subscribers/base.rb +3 -0
  71. data/lib/awesome_explain/subscribers/command_subscriber.rb +53 -0
  72. data/lib/awesome_explain/tasks/db.rb +325 -0
  73. data/lib/awesome_explain/utils/color.rb +16 -0
  74. data/lib/awesome_explain/version.rb +1 -1
  75. data/lib/tasks/ae.rake +28 -0
  76. data/lib/tasks/awesome_explain_tasks.rake +4 -0
  77. metadata +242 -25
  78. data/.travis.yml +0 -19
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "5.0"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,209 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ awesome_explain (1.0.0)
5
+ activerecord-import (>= 0.25)
6
+ awesome_print (~> 1.0)
7
+ kaminari (>= 1.0)
8
+ niceql
9
+ pg
10
+ rails (>= 4.2, <= 6.1)
11
+ sqlite3
12
+ terminal-table (~> 1.0)
13
+
14
+ GEM
15
+ remote: https://rubygems.org/
16
+ specs:
17
+ actioncable (5.0.0)
18
+ actionpack (= 5.0.0)
19
+ nio4r (~> 1.2)
20
+ websocket-driver (~> 0.6.1)
21
+ actionmailer (5.0.0)
22
+ actionpack (= 5.0.0)
23
+ actionview (= 5.0.0)
24
+ activejob (= 5.0.0)
25
+ mail (~> 2.5, >= 2.5.4)
26
+ rails-dom-testing (~> 2.0)
27
+ actionpack (5.0.0)
28
+ actionview (= 5.0.0)
29
+ activesupport (= 5.0.0)
30
+ rack (~> 2.0)
31
+ rack-test (~> 0.6.3)
32
+ rails-dom-testing (~> 2.0)
33
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
34
+ actionview (5.0.0)
35
+ activesupport (= 5.0.0)
36
+ builder (~> 3.1)
37
+ erubis (~> 2.7.0)
38
+ rails-dom-testing (~> 2.0)
39
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
40
+ activejob (5.0.0)
41
+ activesupport (= 5.0.0)
42
+ globalid (>= 0.3.6)
43
+ activemodel (5.0.0)
44
+ activesupport (= 5.0.0)
45
+ activerecord (5.0.0)
46
+ activemodel (= 5.0.0)
47
+ activesupport (= 5.0.0)
48
+ arel (~> 7.0)
49
+ activerecord-import (1.0.8)
50
+ activerecord (>= 3.2)
51
+ activesupport (5.0.0)
52
+ concurrent-ruby (~> 1.0, >= 1.0.2)
53
+ i18n (~> 0.7)
54
+ minitest (~> 5.1)
55
+ tzinfo (~> 1.1)
56
+ ansi (1.5.0)
57
+ appraisal (2.4.0)
58
+ bundler
59
+ rake
60
+ thor (>= 0.14.0)
61
+ arel (7.1.4)
62
+ awesome_print (1.9.2)
63
+ binding_of_caller (1.0.0)
64
+ debug_inspector (>= 0.0.1)
65
+ bson (4.12.0)
66
+ builder (3.2.4)
67
+ byebug (11.1.3)
68
+ coderay (1.1.3)
69
+ concurrent-ruby (1.1.8)
70
+ crass (1.0.6)
71
+ debug_inspector (1.0.0)
72
+ diff-lcs (1.4.4)
73
+ docile (1.3.5)
74
+ erubis (2.7.0)
75
+ globalid (0.4.2)
76
+ activesupport (>= 4.2.0)
77
+ i18n (0.9.5)
78
+ concurrent-ruby (~> 1.0)
79
+ kaminari (1.2.1)
80
+ activesupport (>= 4.1.0)
81
+ kaminari-actionview (= 1.2.1)
82
+ kaminari-activerecord (= 1.2.1)
83
+ kaminari-core (= 1.2.1)
84
+ kaminari-actionview (1.2.1)
85
+ actionview
86
+ kaminari-core (= 1.2.1)
87
+ kaminari-activerecord (1.2.1)
88
+ activerecord
89
+ kaminari-core (= 1.2.1)
90
+ kaminari-core (1.2.1)
91
+ loofah (2.9.0)
92
+ crass (~> 1.0.2)
93
+ nokogiri (>= 1.5.9)
94
+ mail (2.7.1)
95
+ mini_mime (>= 0.1.1)
96
+ method_source (1.0.0)
97
+ mini_mime (1.0.2)
98
+ mini_portile2 (2.5.0)
99
+ minitest (5.14.4)
100
+ mongo (2.14.0)
101
+ bson (>= 4.8.2, < 5.0.0)
102
+ mongoid (6.1.1)
103
+ activemodel (~> 5.0)
104
+ mongo (>= 2.4.1, < 3.0.0)
105
+ niceql (0.1.25)
106
+ nio4r (1.2.1)
107
+ nokogiri (1.11.2)
108
+ mini_portile2 (~> 2.5.0)
109
+ racc (~> 1.4)
110
+ pg (1.2.3)
111
+ pry (0.13.1)
112
+ coderay (~> 1.1)
113
+ method_source (~> 1.0)
114
+ pry-byebug (3.9.0)
115
+ byebug (~> 11.0)
116
+ pry (~> 0.13.0)
117
+ pry-rails (0.3.9)
118
+ pry (>= 0.10.4)
119
+ racc (1.5.2)
120
+ rack (2.2.3)
121
+ rack-test (0.6.3)
122
+ rack (>= 1.0)
123
+ rails (5.0.0)
124
+ actioncable (= 5.0.0)
125
+ actionmailer (= 5.0.0)
126
+ actionpack (= 5.0.0)
127
+ actionview (= 5.0.0)
128
+ activejob (= 5.0.0)
129
+ activemodel (= 5.0.0)
130
+ activerecord (= 5.0.0)
131
+ activesupport (= 5.0.0)
132
+ bundler (>= 1.3.0, < 2.0)
133
+ railties (= 5.0.0)
134
+ sprockets-rails (>= 2.0.0)
135
+ rails-dom-testing (2.0.3)
136
+ activesupport (>= 4.2.0)
137
+ nokogiri (>= 1.6)
138
+ rails-html-sanitizer (1.3.0)
139
+ loofah (~> 2.3)
140
+ railties (5.0.0)
141
+ actionpack (= 5.0.0)
142
+ activesupport (= 5.0.0)
143
+ method_source
144
+ rake (>= 0.8.7)
145
+ thor (>= 0.18.1, < 2.0)
146
+ rake (13.0.3)
147
+ rspec (3.10.0)
148
+ rspec-core (~> 3.10.0)
149
+ rspec-expectations (~> 3.10.0)
150
+ rspec-mocks (~> 3.10.0)
151
+ rspec-core (3.10.1)
152
+ rspec-support (~> 3.10.0)
153
+ rspec-expectations (3.10.1)
154
+ diff-lcs (>= 1.2.0, < 2.0)
155
+ rspec-support (~> 3.10.0)
156
+ rspec-mocks (3.10.2)
157
+ diff-lcs (>= 1.2.0, < 2.0)
158
+ rspec-support (~> 3.10.0)
159
+ rspec-support (3.10.2)
160
+ simplecov (0.21.2)
161
+ docile (~> 1.1)
162
+ simplecov-html (~> 0.11)
163
+ simplecov_json_formatter (~> 0.1)
164
+ simplecov-console (0.9.1)
165
+ ansi
166
+ simplecov
167
+ terminal-table
168
+ simplecov-html (0.12.3)
169
+ simplecov_json_formatter (0.1.2)
170
+ sprockets (4.0.2)
171
+ concurrent-ruby (~> 1.0)
172
+ rack (> 1, < 3)
173
+ sprockets-rails (3.2.2)
174
+ actionpack (>= 4.0)
175
+ activesupport (>= 4.0)
176
+ sprockets (>= 3.0.0)
177
+ sqlite3 (1.4.2)
178
+ terminal-table (1.8.0)
179
+ unicode-display_width (~> 1.1, >= 1.1.1)
180
+ thor (1.1.0)
181
+ thread_safe (0.3.6)
182
+ tzinfo (1.2.9)
183
+ thread_safe (~> 0.1)
184
+ unicode-display_width (1.7.0)
185
+ websocket-driver (0.6.5)
186
+ websocket-extensions (>= 0.1.0)
187
+ websocket-extensions (0.1.5)
188
+ wwtd (1.4.1)
189
+
190
+ PLATFORMS
191
+ ruby
192
+
193
+ DEPENDENCIES
194
+ appraisal
195
+ awesome_explain!
196
+ binding_of_caller
197
+ bundler
198
+ mongoid (>= 5)
199
+ pry-byebug
200
+ pry-rails
201
+ rails (= 5.0)
202
+ rake (>= 10.0)
203
+ rspec (>= 3.10)
204
+ simplecov (>= 0.21.2)
205
+ simplecov-console (>= 0.9.1)
206
+ wwtd
207
+
208
+ BUNDLED WITH
209
+ 1.17.3
@@ -0,0 +1,7 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "rails", "6.0"
6
+
7
+ gemspec path: "../"
@@ -0,0 +1,233 @@
1
+ PATH
2
+ remote: ..
3
+ specs:
4
+ awesome_explain (1.0.0)
5
+ activerecord-import (>= 0.25)
6
+ awesome_print (~> 1.0)
7
+ kaminari (>= 1.0)
8
+ niceql
9
+ pg
10
+ rails (>= 4.2, <= 6.1)
11
+ sqlite3
12
+ terminal-table (~> 1.0)
13
+
14
+ GEM
15
+ remote: https://rubygems.org/
16
+ specs:
17
+ actioncable (6.0.0)
18
+ actionpack (= 6.0.0)
19
+ nio4r (~> 2.0)
20
+ websocket-driver (>= 0.6.1)
21
+ actionmailbox (6.0.0)
22
+ actionpack (= 6.0.0)
23
+ activejob (= 6.0.0)
24
+ activerecord (= 6.0.0)
25
+ activestorage (= 6.0.0)
26
+ activesupport (= 6.0.0)
27
+ mail (>= 2.7.1)
28
+ actionmailer (6.0.0)
29
+ actionpack (= 6.0.0)
30
+ actionview (= 6.0.0)
31
+ activejob (= 6.0.0)
32
+ mail (~> 2.5, >= 2.5.4)
33
+ rails-dom-testing (~> 2.0)
34
+ actionpack (6.0.0)
35
+ actionview (= 6.0.0)
36
+ activesupport (= 6.0.0)
37
+ rack (~> 2.0)
38
+ rack-test (>= 0.6.3)
39
+ rails-dom-testing (~> 2.0)
40
+ rails-html-sanitizer (~> 1.0, >= 1.2.0)
41
+ actiontext (6.0.0)
42
+ actionpack (= 6.0.0)
43
+ activerecord (= 6.0.0)
44
+ activestorage (= 6.0.0)
45
+ activesupport (= 6.0.0)
46
+ nokogiri (>= 1.8.5)
47
+ actionview (6.0.0)
48
+ activesupport (= 6.0.0)
49
+ builder (~> 3.1)
50
+ erubi (~> 1.4)
51
+ rails-dom-testing (~> 2.0)
52
+ rails-html-sanitizer (~> 1.1, >= 1.2.0)
53
+ activejob (6.0.0)
54
+ activesupport (= 6.0.0)
55
+ globalid (>= 0.3.6)
56
+ activemodel (6.0.0)
57
+ activesupport (= 6.0.0)
58
+ activerecord (6.0.0)
59
+ activemodel (= 6.0.0)
60
+ activesupport (= 6.0.0)
61
+ activerecord-import (1.0.8)
62
+ activerecord (>= 3.2)
63
+ activestorage (6.0.0)
64
+ actionpack (= 6.0.0)
65
+ activejob (= 6.0.0)
66
+ activerecord (= 6.0.0)
67
+ marcel (~> 0.3.1)
68
+ activesupport (6.0.0)
69
+ concurrent-ruby (~> 1.0, >= 1.0.2)
70
+ i18n (>= 0.7, < 2)
71
+ minitest (~> 5.1)
72
+ tzinfo (~> 1.1)
73
+ zeitwerk (~> 2.1, >= 2.1.8)
74
+ ansi (1.5.0)
75
+ appraisal (2.4.0)
76
+ bundler
77
+ rake
78
+ thor (>= 0.14.0)
79
+ awesome_print (1.9.2)
80
+ binding_of_caller (1.0.0)
81
+ debug_inspector (>= 0.0.1)
82
+ bson (4.12.0)
83
+ builder (3.2.4)
84
+ byebug (11.1.3)
85
+ coderay (1.1.3)
86
+ concurrent-ruby (1.1.8)
87
+ crass (1.0.6)
88
+ debug_inspector (1.0.0)
89
+ diff-lcs (1.4.4)
90
+ docile (1.3.5)
91
+ erubi (1.10.0)
92
+ globalid (0.4.2)
93
+ activesupport (>= 4.2.0)
94
+ i18n (1.8.9)
95
+ concurrent-ruby (~> 1.0)
96
+ kaminari (1.2.1)
97
+ activesupport (>= 4.1.0)
98
+ kaminari-actionview (= 1.2.1)
99
+ kaminari-activerecord (= 1.2.1)
100
+ kaminari-core (= 1.2.1)
101
+ kaminari-actionview (1.2.1)
102
+ actionview
103
+ kaminari-core (= 1.2.1)
104
+ kaminari-activerecord (1.2.1)
105
+ activerecord
106
+ kaminari-core (= 1.2.1)
107
+ kaminari-core (1.2.1)
108
+ loofah (2.9.0)
109
+ crass (~> 1.0.2)
110
+ nokogiri (>= 1.5.9)
111
+ mail (2.7.1)
112
+ mini_mime (>= 0.1.1)
113
+ marcel (0.3.3)
114
+ mimemagic (~> 0.3.2)
115
+ method_source (1.0.0)
116
+ mimemagic (0.3.5)
117
+ mini_mime (1.0.2)
118
+ mini_portile2 (2.5.0)
119
+ minitest (5.14.4)
120
+ mongo (2.14.0)
121
+ bson (>= 4.8.2, < 5.0.0)
122
+ mongoid (7.2.1)
123
+ activemodel (>= 5.1, < 6.2)
124
+ mongo (>= 2.10.5, < 3.0.0)
125
+ niceql (0.1.25)
126
+ nio4r (2.5.7)
127
+ nokogiri (1.11.2)
128
+ mini_portile2 (~> 2.5.0)
129
+ racc (~> 1.4)
130
+ pg (1.2.3)
131
+ pry (0.13.1)
132
+ coderay (~> 1.1)
133
+ method_source (~> 1.0)
134
+ pry-byebug (3.9.0)
135
+ byebug (~> 11.0)
136
+ pry (~> 0.13.0)
137
+ pry-rails (0.3.9)
138
+ pry (>= 0.10.4)
139
+ racc (1.5.2)
140
+ rack (2.2.3)
141
+ rack-test (1.1.0)
142
+ rack (>= 1.0, < 3)
143
+ rails (6.0.0)
144
+ actioncable (= 6.0.0)
145
+ actionmailbox (= 6.0.0)
146
+ actionmailer (= 6.0.0)
147
+ actionpack (= 6.0.0)
148
+ actiontext (= 6.0.0)
149
+ actionview (= 6.0.0)
150
+ activejob (= 6.0.0)
151
+ activemodel (= 6.0.0)
152
+ activerecord (= 6.0.0)
153
+ activestorage (= 6.0.0)
154
+ activesupport (= 6.0.0)
155
+ bundler (>= 1.3.0)
156
+ railties (= 6.0.0)
157
+ sprockets-rails (>= 2.0.0)
158
+ rails-dom-testing (2.0.3)
159
+ activesupport (>= 4.2.0)
160
+ nokogiri (>= 1.6)
161
+ rails-html-sanitizer (1.3.0)
162
+ loofah (~> 2.3)
163
+ railties (6.0.0)
164
+ actionpack (= 6.0.0)
165
+ activesupport (= 6.0.0)
166
+ method_source
167
+ rake (>= 0.8.7)
168
+ thor (>= 0.20.3, < 2.0)
169
+ rake (13.0.3)
170
+ rspec (3.10.0)
171
+ rspec-core (~> 3.10.0)
172
+ rspec-expectations (~> 3.10.0)
173
+ rspec-mocks (~> 3.10.0)
174
+ rspec-core (3.10.1)
175
+ rspec-support (~> 3.10.0)
176
+ rspec-expectations (3.10.1)
177
+ diff-lcs (>= 1.2.0, < 2.0)
178
+ rspec-support (~> 3.10.0)
179
+ rspec-mocks (3.10.2)
180
+ diff-lcs (>= 1.2.0, < 2.0)
181
+ rspec-support (~> 3.10.0)
182
+ rspec-support (3.10.2)
183
+ simplecov (0.21.2)
184
+ docile (~> 1.1)
185
+ simplecov-html (~> 0.11)
186
+ simplecov_json_formatter (~> 0.1)
187
+ simplecov-console (0.9.1)
188
+ ansi
189
+ simplecov
190
+ terminal-table
191
+ simplecov-html (0.12.3)
192
+ simplecov_json_formatter (0.1.2)
193
+ sprockets (4.0.2)
194
+ concurrent-ruby (~> 1.0)
195
+ rack (> 1, < 3)
196
+ sprockets-rails (3.2.2)
197
+ actionpack (>= 4.0)
198
+ activesupport (>= 4.0)
199
+ sprockets (>= 3.0.0)
200
+ sqlite3 (1.4.2)
201
+ terminal-table (1.8.0)
202
+ unicode-display_width (~> 1.1, >= 1.1.1)
203
+ thor (1.1.0)
204
+ thread_safe (0.3.6)
205
+ tzinfo (1.2.9)
206
+ thread_safe (~> 0.1)
207
+ unicode-display_width (1.7.0)
208
+ websocket-driver (0.7.3)
209
+ websocket-extensions (>= 0.1.0)
210
+ websocket-extensions (0.1.5)
211
+ wwtd (1.4.1)
212
+ zeitwerk (2.4.2)
213
+
214
+ PLATFORMS
215
+ ruby
216
+
217
+ DEPENDENCIES
218
+ appraisal
219
+ awesome_explain!
220
+ binding_of_caller
221
+ bundler
222
+ mongoid (>= 5)
223
+ pry-byebug
224
+ pry-rails
225
+ rails (= 6.0)
226
+ rake (>= 10.0)
227
+ rspec (>= 3.10)
228
+ simplecov (>= 0.21.2)
229
+ simplecov-console (>= 0.9.1)
230
+ wwtd
231
+
232
+ BUNDLED WITH
233
+ 1.17.3