pghero 2.2.1 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of pghero might be problematic. Click here for more details.

Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +100 -53
  3. data/README.md +20 -8
  4. data/app/assets/javascripts/pghero/Chart.bundle.js +16260 -15580
  5. data/app/assets/javascripts/pghero/application.js +8 -7
  6. data/app/assets/javascripts/pghero/chartkick.js +1973 -1325
  7. data/app/assets/javascripts/pghero/highlight.pack.js +2 -2
  8. data/app/assets/javascripts/pghero/jquery.js +3605 -4015
  9. data/app/assets/javascripts/pghero/nouislider.js +2479 -0
  10. data/app/assets/stylesheets/pghero/application.css +1 -1
  11. data/app/assets/stylesheets/pghero/nouislider.css +299 -0
  12. data/app/controllers/pg_hero/home_controller.rb +97 -42
  13. data/app/helpers/pg_hero/home_helper.rb +11 -0
  14. data/app/views/pg_hero/home/_live_queries_table.html.erb +14 -3
  15. data/app/views/pg_hero/home/connections.html.erb +9 -0
  16. data/app/views/pg_hero/home/index.html.erb +49 -10
  17. data/app/views/pg_hero/home/live_queries.html.erb +1 -1
  18. data/app/views/pg_hero/home/maintenance.html.erb +16 -2
  19. data/app/views/pg_hero/home/relation_space.html.erb +2 -2
  20. data/app/views/pg_hero/home/show_query.html.erb +4 -5
  21. data/app/views/pg_hero/home/space.html.erb +3 -3
  22. data/app/views/pg_hero/home/system.html.erb +4 -4
  23. data/app/views/pg_hero/home/tune.html.erb +2 -1
  24. data/lib/generators/pghero/config_generator.rb +1 -1
  25. data/lib/generators/pghero/query_stats_generator.rb +3 -20
  26. data/lib/generators/pghero/space_stats_generator.rb +3 -20
  27. data/lib/generators/pghero/templates/config.yml.tt +21 -1
  28. data/lib/pghero.rb +82 -17
  29. data/lib/pghero/database.rb +104 -19
  30. data/lib/pghero/methods/basic.rb +34 -25
  31. data/lib/pghero/methods/connections.rb +35 -0
  32. data/lib/pghero/methods/constraints.rb +30 -0
  33. data/lib/pghero/methods/explain.rb +1 -1
  34. data/lib/pghero/methods/indexes.rb +1 -1
  35. data/lib/pghero/methods/maintenance.rb +3 -1
  36. data/lib/pghero/methods/queries.rb +7 -3
  37. data/lib/pghero/methods/query_stats.rb +93 -25
  38. data/lib/pghero/methods/sequences.rb +1 -1
  39. data/lib/pghero/methods/space.rb +4 -0
  40. data/lib/pghero/methods/suggested_indexes.rb +1 -1
  41. data/lib/pghero/methods/system.rb +219 -23
  42. data/lib/pghero/methods/users.rb +4 -0
  43. data/lib/pghero/query_stats.rb +1 -3
  44. data/lib/pghero/space_stats.rb +5 -0
  45. data/lib/pghero/stats.rb +6 -0
  46. data/lib/pghero/version.rb +1 -1
  47. data/lib/tasks/pghero.rake +10 -4
  48. metadata +15 -12
  49. data/app/assets/javascripts/pghero/jquery.nouislider.min.js +0 -31
  50. data/app/assets/stylesheets/pghero/jquery.nouislider.css +0 -165
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7edafa3113ab1d1e6dd6df9c2abb1fe90ccd1077811475c001cfef05c021e8d9
4
- data.tar.gz: f7e65b01aa540e9023c30c9cefcbf2fd7381fb71b24852043c82e81e878bc8f7
3
+ metadata.gz: 38e408389854af6f5a2a71ee70bc3d66c257a299b1a1fec255c279819db00482
4
+ data.tar.gz: 2f492cf50fd99032ec9ac9cfd03df70ef5c4d45ea55a0c14a5c608102b5aa106
5
5
  SHA512:
6
- metadata.gz: 857502906ac831709d69a371f4da5ca2bce260f55f72731f3db48be28b159d0816080e2dd90f87301653c609dc5d0dd27ec36d0e58f0649c45d18e9046851bc0
7
- data.tar.gz: f54eb2b5e13a75b691fcb3efcc3b63d921a33194caf2f4d62147f8d7090faa4cfa70abfc379315bed61378176f2ef8919747990ed9ba8ff4f3886a32f54edbd3
6
+ metadata.gz: edc72b96fb3c766f41682c22aa2287a99c610435687794d0a09395821a129709b0e464f7e9031d43cac7a6d1bc334cb419885dc32b87d9d4e58a75d810c3ba30
7
+ data.tar.gz: a4ad92136153cb3f607bddb0b289d3c180a6a653f7a6eac9b47ca6fe7fa04626923f7b84e80951577c9a94314c2487ac7dccb4cdd5f2483a3076473893bac13e
data/CHANGELOG.md CHANGED
@@ -1,10 +1,57 @@
1
- ## 2.2.1
1
+ ## 2.7.0 (2020-08-04)
2
+
3
+ - Fixed CSRF vulnerability with non-session based authentication
4
+ - Added `database`, `user`, and `query_hash` options to `reset_query_stats` method
5
+
6
+ ## 2.6.0 (2020-07-09)
7
+
8
+ - Added support for Postgres 13 beta 2
9
+ - Added support for non-integer explain timeout
10
+
11
+ ## 2.5.1 (2020-06-23)
12
+
13
+ - Added support for `google-cloud-monitoring` >= 1
14
+ - Added support for `google-cloud-monitoring-v3`
15
+ - Fixed system stats not showing up in Rails 6 with environment variables
16
+
17
+ ## 2.5.0 (2020-05-24)
18
+
19
+ - Added system stats for Google Cloud SQL and Azure Database
20
+ - Added experimental `filter_data` option
21
+ - Localized times on maintenance page
22
+ - Improved connection pooling
23
+ - Improved error message for non-Postgres connections
24
+ - Fixed more deprecation warnings in Ruby 2.7
25
+
26
+ ## 2.4.2 (2020-04-16)
27
+
28
+ - Added `connections` method
29
+ - Fixed deprecation warnings in Ruby 2.7
30
+
31
+ ## 2.4.1 (2019-11-21)
32
+
33
+ - Fixed file permissions on `highlight.pack.js`
34
+
35
+ ## 2.4.0 (2019-11-11)
36
+
37
+ - Added `invalid_constraints` method
38
+ - Added `spec` option
39
+ - Added `override_csp` option
40
+ - Show all databases in Rails 6 when no config
41
+
42
+ ## 2.3.0 (2019-08-18)
43
+
44
+ - Added support for Postgres 12 beta 1
45
+ - Added methods and tasks for cleaning up stats
46
+ - Dropped support for Rails < 5
47
+
48
+ ## 2.2.1 (2019-06-04)
2
49
 
3
50
  - Added `config_path` option
4
51
  - Fixed error with sequences when temporary tables
5
52
  - Fixed error when `config.action_controller.include_all_helpers = false`
6
53
 
7
- ## 2.2.0
54
+ ## 2.2.0 (2018-09-03)
8
55
 
9
56
  - Added check for connections idle in transaction
10
57
  - Improved duplicate index logic to detect more duplicates
@@ -12,64 +59,64 @@
12
59
  - Fixed error with large number of sequences
13
60
  - Bumped `total_connections_threshold` to 500 by default
14
61
 
15
- ## 2.1.1
62
+ ## 2.1.1 (2018-04-24)
16
63
 
17
64
  - Added `explain_timeout_sec` option
18
65
  - Fixed error with unparsable sequences
19
66
  - Stopped throwing `Same sequence name in multiple schemas` error
20
67
 
21
- ## 2.1.0
68
+ ## 2.1.0 (2017-11-30)
22
69
 
23
70
  - Fixed issue with sequences in different schema than table
24
71
  - No longer throw errors for unreadable sequences
25
72
  - Fixed replication lag for Amazon Aurora
26
73
  - Added `vacuum_progress` method
27
74
 
28
- ## 2.0.8
75
+ ## 2.0.8 (2017-11-12)
29
76
 
30
77
  - Added support for Postgres 10 replicas
31
78
  - Added support for pg_query 1.0.0
32
79
  - Show queries with insufficient privilege on live queries page
33
80
  - Default to table schema for sequences
34
81
 
35
- ## 2.0.7
82
+ ## 2.0.7 (2017-10-28)
36
83
 
37
84
  - Fixed issue with sequences in different schema than table
38
85
  - Fixed query details when multiple users have same query hash
39
86
  - Fixed error with invalid indexes in non-public schema
40
87
  - Raise error when capture query stats fails
41
88
 
42
- ## 2.0.6
89
+ ## 2.0.6 (2017-09-24)
43
90
 
44
91
  - More robust methods for multiple databases
45
92
  - Added support for `RAILS_RELATIVE_URL_ROOT` for Linux and Docker
46
93
 
47
- ## 2.0.5
94
+ ## 2.0.5 (2017-09-14)
48
95
 
49
96
  - Fixed error with sequences in different schemas
50
97
  - Better advice
51
98
 
52
- ## 2.0.4
99
+ ## 2.0.4 (2017-08-28)
53
100
 
54
101
  - Fixed `AssetNotPrecompiled` error
55
102
  - Do not silently ignore sequence danger when user does not have permissions
56
103
 
57
- ## 2.0.3
104
+ ## 2.0.3 (2017-08-22)
58
105
 
59
106
  - Added SQL to recreate invalid indexes
60
107
  - Added unused index marker to Space page
61
108
  - Fixed `capture_query_stats` on Postgres < 9.4
62
109
 
63
- ## 2.0.2
110
+ ## 2.0.2 (2017-08-09)
64
111
 
65
112
  - Fixed error with suggested indexes
66
113
  - Fixed error with `pg_replication_slots`
67
114
 
68
- ## 2.0.1
115
+ ## 2.0.1 (2017-08-08)
69
116
 
70
117
  - Fixed capture space stats
71
118
 
72
- ## 2.0.0
119
+ ## 2.0.0 (2017-08-08)
73
120
 
74
121
  New features
75
122
 
@@ -100,27 +147,27 @@ PgHero.with(:database2) { PgHero.running_queries }
100
147
  - Removed options from `connection_sources` method
101
148
  - Removed `locks` method
102
149
 
103
- ## 1.7.0
150
+ ## 1.7.0 (2017-05-01)
104
151
 
105
152
  - Fixed migrations for Rails 5.1+
106
153
  - Added `analyze`, `analyze_tables`, and `analyze_all` methods
107
154
  - Added `pghero:analyze` rake task
108
155
  - Fixed system stats display issue
109
156
 
110
- ## 1.6.5
157
+ ## 1.6.5 (2017-04-19)
111
158
 
112
159
  - Added support for Rails API
113
160
  - Added support for Amazon STS
114
161
  - Fixed replica check when `hot_standby = on` for primary
115
162
 
116
- ## 1.6.4
163
+ ## 1.6.4 (2017-03-12)
117
164
 
118
165
  - Only show connection charts if there are connections
119
166
  - Fixed duplicate indexes for multiple schemas
120
167
  - Fixed display issue for queries without word break
121
168
  - Removed maintenance tab for replicas
122
169
 
123
- ## 1.6.3
170
+ ## 1.6.3 (2017-02-09)
124
171
 
125
172
  - Added 10 second timeout for explain
126
173
  - No longer show autovacuum in long running queries
@@ -129,36 +176,36 @@ PgHero.with(:database2) { PgHero.running_queries }
129
176
  - Removed Chartkick gem dependency for charts
130
177
  - Fixed error when primary database is not PostgreSQL
131
178
 
132
- ## 1.6.2
179
+ ## 1.6.2 (2016-10-26)
133
180
 
134
181
  - Suggest GiST over GIN for `LIKE` queries again (seeing better performance)
135
182
 
136
- ## 1.6.1
183
+ ## 1.6.1 (2016-10-24)
137
184
 
138
185
  - Suggest GIN over GiST for `LIKE` queries
139
186
 
140
- ## 1.6.0
187
+ ## 1.6.0 (2016-10-20)
141
188
 
142
189
  - Removed mostly inactionable items (cache hit rate and index usage)
143
190
  - Restored duplicate indexes to homepage
144
191
  - Fixed issue with exact duplicate indexes
145
192
  - Way better `blocked_queries` method
146
193
 
147
- ## 1.5.3
194
+ ## 1.5.3 (2016-10-06)
148
195
 
149
196
  - Fixed Rails 5 error with multiple databases
150
197
  - Fixed duplicate index detection with expressions
151
198
 
152
- ## 1.5.2
199
+ ## 1.5.2 (2016-10-01)
153
200
 
154
201
  - Added support for PostgreSQL 9.6
155
202
  - Fixed incorrect query start for live queries in transactions
156
203
 
157
- ## 1.5.1
204
+ ## 1.5.1 (2016-09-27)
158
205
 
159
206
  - Better tune page for PostgreSQL 9.5
160
207
 
161
- ## 1.5.0
208
+ ## 1.5.0 (2016-09-21)
162
209
 
163
210
  - Added user to query stats (opt-in)
164
211
  - Added user to connection sources
@@ -166,52 +213,52 @@ PgHero.with(:database2) { PgHero.running_queries }
166
213
  - Added visualize button to explain page
167
214
  - Better charts for system stats
168
215
 
169
- ## 1.4.2
216
+ ## 1.4.2 (2016-09-06)
170
217
 
171
218
  - Fixed `wrong constant name` error in development
172
219
  - Added different periods for system stats
173
220
 
174
- ## 1.4.1
221
+ ## 1.4.1 (2016-08-25)
175
222
 
176
223
  - Removed external assets
177
224
 
178
- ## 1.4.0
225
+ ## 1.4.0 (2016-08-24)
179
226
 
180
227
  - Updated for Rails 5
181
228
  - Fixed error when `pg_stat_statements` not enabled in `shared_libaries`
182
229
 
183
- ## 1.3.2
230
+ ## 1.3.2 (2016-08-03)
184
231
 
185
232
  - Improved performance of query stats
186
233
 
187
- ## 1.3.1
234
+ ## 1.3.1 (2016-07-10)
188
235
 
189
236
  - Improved grouping of query stats
190
237
  - Added `blocked_queries` method
191
238
 
192
- ## 1.3.0
239
+ ## 1.3.0 (2016-06-27)
193
240
 
194
241
  - Added query hash for better query stats grouping
195
242
  - Added sequence danger check
196
243
  - Added `capture_query_stats` option to config
197
244
 
198
- ## 1.2.4
245
+ ## 1.2.4 (2016-05-06)
199
246
 
200
247
  - Fixed user methods
201
248
 
202
- ## 1.2.3
249
+ ## 1.2.3 (2016-04-20)
203
250
 
204
251
  - Added schema to queries
205
252
  - Fixed deprecation warning on Rails 5
206
253
  - Fix for pg_query >= 0.9.0
207
254
 
208
- ## 1.2.2
255
+ ## 1.2.2 (2016-01-20)
209
256
 
210
257
  - Better suggested indexes
211
258
  - Removed duplicate indexes noise
212
259
  - Fixed partial and expression indexes
213
260
 
214
- ## 1.2.1
261
+ ## 1.2.1 (2016-01-07)
215
262
 
216
263
  - Better suggested indexes
217
264
  - Removed unused indexes noise
@@ -220,7 +267,7 @@ PgHero.with(:database2) { PgHero.running_queries }
220
267
  - Fixed suggested indexes for replicas
221
268
  - Fixed issue w/ suggested indexes where same table name exists in multiple schemas
222
269
 
223
- ## 1.2.0
270
+ ## 1.2.0 (2015-12-31)
224
271
 
225
272
  - Added suggested indexes
226
273
  - Added duplicate indexes
@@ -230,38 +277,38 @@ PgHero.with(:database2) { PgHero.running_queries }
230
277
  - Added configurable cache hit rate threshold
231
278
  - Show all connections in connections tab
232
279
 
233
- ## 1.1.4
280
+ ## 1.1.4 (2015-12-08)
234
281
 
235
282
  - Added check for transaction ID wraparound failure
236
283
  - Added check for autovacuum danger
237
284
 
238
- ## 1.1.3
285
+ ## 1.1.3 (2015-10-21)
239
286
 
240
287
  - Fixed system stats
241
288
 
242
- ## 1.1.2
289
+ ## 1.1.2 (2015-10-18)
243
290
 
244
291
  - Added invalid indexes
245
292
  - Fixed RDS stats for aws-sdk 2
246
293
 
247
- ## 1.1.1
294
+ ## 1.1.1 (2015-07-23)
248
295
 
249
296
  - Added `tables` option to `create_user` method
250
297
  - Added ability to sort query stats by average_time and calls
251
298
  - Only show unused indexes with no index scans in UI
252
299
 
253
- ## 1.1.0
300
+ ## 1.1.0 (2015-06-26)
254
301
 
255
302
  - Added historical query stats
256
303
 
257
- ## 1.0.1
304
+ ## 1.0.1 (2015-04-17)
258
305
 
259
306
  - Fixed connection bad errors
260
307
  - Restore previous connection properly for nested with blocks
261
308
  - Added analyze button to explain page
262
309
  - Added explain button to live queries page
263
310
 
264
- ## 1.0.0
311
+ ## 1.0.0 (2015-04-11)
265
312
 
266
313
  - More platforms!
267
314
  - Support for multiple databases!
@@ -271,61 +318,61 @@ PgHero.with(:database2) { PgHero.running_queries }
271
318
  - Added `kill_long_running_queries` method
272
319
  - Added env vars for settings
273
320
 
274
- ## 0.1.10
321
+ ## 0.1.10 (2015-03-20)
275
322
 
276
323
  - Added connections page
277
324
  - Added message for insufficient privilege
278
325
  - Added `ip` to `connection_sources`
279
326
 
280
- ## 0.1.9
327
+ ## 0.1.9 (2015-01-25)
281
328
 
282
329
  - Added tune page
283
330
  - Removed minimum size for unused indexes
284
331
 
285
- ## 0.1.8
332
+ ## 0.1.8 (2015-01-19)
286
333
 
287
334
  - Added `total_percent` to `query_stats`
288
335
  - Added `total_connections`
289
336
  - Added `connection_stats` for Amazon RDS
290
337
 
291
- ## 0.1.7
338
+ ## 0.1.7 (2014-11-12)
292
339
 
293
340
  - Added support for pg_stat_statments on Amazon RDS
294
341
  - Added `long_running_query_sec`, `slow_query_ms` and `slow_query_calls` options
295
342
 
296
- ## 0.1.6
343
+ ## 0.1.6 (2014-10-09)
297
344
 
298
345
  - Added methods to create and drop users
299
346
  - Added locks
300
347
 
301
- ## 0.1.5
348
+ ## 0.1.5 (2014-09-03)
302
349
 
303
350
  - Added system stats for Amazon RDS
304
351
  - Added code to remove unused indexes
305
352
  - Require unused indexes to be at least 1 MB
306
353
  - Use `pg_terminate_backend` to ensure queries are killed
307
354
 
308
- ## 0.1.4
355
+ ## 0.1.4 (2014-08-31)
309
356
 
310
357
  - Reduced long running queries threshold to 1 minute
311
358
  - Fixed duration
312
359
  - Fixed wrapping
313
360
  - Friendlier dependencies for JRuby
314
361
 
315
- ## 0.1.3
362
+ ## 0.1.3 (2014-08-04)
316
363
 
317
364
  - Reverted `query_stats_available?` fix
318
365
 
319
- ## 0.1.2
366
+ ## 0.1.2 (2014-08-03)
320
367
 
321
368
  - Fixed `query_stats_available?` method
322
369
 
323
- ## 0.1.1
370
+ ## 0.1.1 (2014-08-03)
324
371
 
325
372
  - Added explain
326
373
  - Added query stats
327
374
  - Fixed CSS issues
328
375
 
329
- ## 0.1.0
376
+ ## 0.1.0 (2014-07-23)
330
377
 
331
378
  - First major release
data/README.md CHANGED
@@ -10,30 +10,42 @@ A performance dashboard for Postgres
10
10
 
11
11
  ---
12
12
 
13
- [![Screenshot](https://pghero.dokkuapp.com/assets/screenshot-5a368624ada55b32e7668c96926840f9.png)](https://pghero.dokkuapp.com/)
13
+ [![Screenshot](https://pghero.dokkuapp.com/assets/pghero-f8abe426e6bf54bb7dba87b425bb809740ebd386208bcd280a7e802b053a1023.png)](https://pghero.dokkuapp.com/)
14
+
15
+ :tangerine: Battle-tested at [Instacart](https://www.instacart.com/opensource)
16
+
17
+ [![Build Status](https://travis-ci.org/ankane/pghero.svg?branch=master)](https://travis-ci.org/ankane/pghero) [![Docker Pulls](https://img.shields.io/docker/pulls/ankane/pghero)](https://hub.docker.com/repository/docker/ankane/pghero)
14
18
 
15
19
  ## Installation
16
20
 
17
- PgHero is available as a Rails engine, Linux package, and Docker image.
21
+ PgHero is available as a Docker image, Linux package, and Rails engine.
18
22
 
19
23
  Select your preferred method of installation to get started.
20
24
 
21
- - [Rails](guides/Rails.md)
22
- - [Linux](guides/Linux.md)
23
25
  - [Docker](guides/Docker.md)
26
+ - [Linux](guides/Linux.md)
27
+ - [Rails](guides/Rails.md)
24
28
 
25
29
  ## Related Projects
26
30
 
31
+ - [Dexter](https://github.com/ankane/dexter) - The automatic indexer for Postgres
27
32
  - [PgBouncerHero](https://github.com/kwent/pgbouncerhero) - A dashboard for PgBouncer
28
33
  - [pgsync](https://github.com/ankane/pgsync) - Sync Postgres data between databases
29
34
  - [pgslice](https://github.com/ankane/pgslice) - Postgres partitioning as easy as pie
30
35
 
31
36
  ## Credits
32
37
 
33
- A big thanks to [Craig Kerstiens](http://www.craigkerstiens.com/2013/01/10/more-on-postgres-performance/) and [Heroku](https://blog.heroku.com/archives/2013/5/10/more_insight_into_your_database_with_pgextras) for the initial queries and [Bootswatch](https://github.com/thomaspark/bootswatch) for the theme :clap:
38
+ A big thanks to [Craig Kerstiens](http://www.craigkerstiens.com/2013/01/10/more-on-postgres-performance/) and [Heroku](https://blog.heroku.com/archives/2013/5/10/more_insight_into_your_database_with_pgextras) for the initial queries and [Bootswatch](https://github.com/thomaspark/bootswatch) for the theme.
34
39
 
35
- Know a bit about PostgreSQL? [Suggestions](https://github.com/ankane/pghero/issues) are greatly appreciated.
40
+ ## History
36
41
 
37
- :tangerine: Battle-tested at [Instacart](https://www.instacart.com/opensource)
42
+ View the [changelog](https://github.com/ankane/pghero/blob/master/CHANGELOG.md)
43
+
44
+ ## Contributing
45
+
46
+ Everyone is encouraged to help improve this project. Here are a few ways you can help:
38
47
 
39
- [![Build Status](https://travis-ci.org/ankane/pghero.svg?branch=master)](https://travis-ci.org/ankane/pghero)
48
+ - [Report bugs](https://github.com/ankane/pghero/issues)
49
+ - Fix bugs and [submit pull requests](https://github.com/ankane/pghero/pulls)
50
+ - Write, clarify, or fix documentation
51
+ - Suggest or add new features