pghero_fork 2.7.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +391 -0
  3. data/CONTRIBUTING.md +42 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +3 -0
  6. data/app/assets/images/pghero/favicon.png +0 -0
  7. data/app/assets/javascripts/pghero/Chart.bundle.js +20755 -0
  8. data/app/assets/javascripts/pghero/application.js +158 -0
  9. data/app/assets/javascripts/pghero/chartkick.js +2436 -0
  10. data/app/assets/javascripts/pghero/highlight.pack.js +2 -0
  11. data/app/assets/javascripts/pghero/jquery.js +10872 -0
  12. data/app/assets/javascripts/pghero/nouislider.js +2672 -0
  13. data/app/assets/stylesheets/pghero/application.css +514 -0
  14. data/app/assets/stylesheets/pghero/arduino-light.css +86 -0
  15. data/app/assets/stylesheets/pghero/nouislider.css +310 -0
  16. data/app/controllers/pg_hero/home_controller.rb +449 -0
  17. data/app/helpers/pg_hero/home_helper.rb +30 -0
  18. data/app/views/layouts/pg_hero/application.html.erb +68 -0
  19. data/app/views/pg_hero/home/_connections_table.html.erb +16 -0
  20. data/app/views/pg_hero/home/_live_queries_table.html.erb +51 -0
  21. data/app/views/pg_hero/home/_queries_table.html.erb +72 -0
  22. data/app/views/pg_hero/home/_query_stats_slider.html.erb +16 -0
  23. data/app/views/pg_hero/home/_suggested_index.html.erb +18 -0
  24. data/app/views/pg_hero/home/connections.html.erb +32 -0
  25. data/app/views/pg_hero/home/explain.html.erb +27 -0
  26. data/app/views/pg_hero/home/index.html.erb +518 -0
  27. data/app/views/pg_hero/home/index_bloat.html.erb +72 -0
  28. data/app/views/pg_hero/home/live_queries.html.erb +11 -0
  29. data/app/views/pg_hero/home/maintenance.html.erb +55 -0
  30. data/app/views/pg_hero/home/queries.html.erb +33 -0
  31. data/app/views/pg_hero/home/relation_space.html.erb +14 -0
  32. data/app/views/pg_hero/home/show_query.html.erb +106 -0
  33. data/app/views/pg_hero/home/space.html.erb +83 -0
  34. data/app/views/pg_hero/home/system.html.erb +34 -0
  35. data/app/views/pg_hero/home/tune.html.erb +53 -0
  36. data/config/routes.rb +32 -0
  37. data/lib/generators/pghero/config_generator.rb +13 -0
  38. data/lib/generators/pghero/query_stats_generator.rb +18 -0
  39. data/lib/generators/pghero/space_stats_generator.rb +18 -0
  40. data/lib/generators/pghero/templates/config.yml.tt +46 -0
  41. data/lib/generators/pghero/templates/query_stats.rb.tt +15 -0
  42. data/lib/generators/pghero/templates/space_stats.rb.tt +13 -0
  43. data/lib/pghero.rb +246 -0
  44. data/lib/pghero/connection.rb +5 -0
  45. data/lib/pghero/database.rb +175 -0
  46. data/lib/pghero/engine.rb +16 -0
  47. data/lib/pghero/methods/basic.rb +160 -0
  48. data/lib/pghero/methods/connections.rb +77 -0
  49. data/lib/pghero/methods/constraints.rb +30 -0
  50. data/lib/pghero/methods/explain.rb +29 -0
  51. data/lib/pghero/methods/indexes.rb +332 -0
  52. data/lib/pghero/methods/kill.rb +28 -0
  53. data/lib/pghero/methods/maintenance.rb +93 -0
  54. data/lib/pghero/methods/queries.rb +75 -0
  55. data/lib/pghero/methods/query_stats.rb +349 -0
  56. data/lib/pghero/methods/replication.rb +74 -0
  57. data/lib/pghero/methods/sequences.rb +124 -0
  58. data/lib/pghero/methods/settings.rb +37 -0
  59. data/lib/pghero/methods/space.rb +141 -0
  60. data/lib/pghero/methods/suggested_indexes.rb +329 -0
  61. data/lib/pghero/methods/system.rb +287 -0
  62. data/lib/pghero/methods/tables.rb +68 -0
  63. data/lib/pghero/methods/users.rb +87 -0
  64. data/lib/pghero/query_stats.rb +5 -0
  65. data/lib/pghero/space_stats.rb +5 -0
  66. data/lib/pghero/stats.rb +6 -0
  67. data/lib/pghero/version.rb +3 -0
  68. data/lib/tasks/pghero.rake +27 -0
  69. data/licenses/LICENSE-chart.js.txt +9 -0
  70. data/licenses/LICENSE-chartkick.js.txt +22 -0
  71. data/licenses/LICENSE-highlight.js.txt +29 -0
  72. data/licenses/LICENSE-jquery.txt +20 -0
  73. data/licenses/LICENSE-moment.txt +22 -0
  74. data/licenses/LICENSE-nouislider.txt +21 -0
  75. metadata +130 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f2d8edd731ca1a36da98b63654ac57c6f9b7a20050b738f981d58917a2f5254f
4
+ data.tar.gz: 55c800a0d44b858b07a2137b2b2cda5c4413c9ecff6461ca5eaf9b6e2d878024
5
+ SHA512:
6
+ metadata.gz: 3a94e928f605273f3857377ce339fa4ecb29f523409a5a87c9b77aa81c953ee76cb64898c4679c183a16010503ea072d36c3c87196a5595f4d49395145e6be5c
7
+ data.tar.gz: 79c31b3427be5403e0a5f6efa927d9c34a7b9437228de669ac61182a724b04f4e85de370b0e2a700c809b2d8c7463e1a2eaa66fefd25a10f399c3d8f46d0283d
@@ -0,0 +1,391 @@
1
+ ## 2.7.3 (2020-11-23)
2
+
3
+ - Improved index suggestions when hash, GiST, GIN, or BRIN index present
4
+
5
+ ## 2.7.2 (2020-09-10)
6
+
7
+ - Fixed error with historical query stats
8
+
9
+ ## 2.7.1 (2020-09-07)
10
+
11
+ - Added `/health` endpoint to Docker image and Linux packages
12
+ - Fixed error with `cast_value`
13
+
14
+ ## 2.7.0 (2020-08-04)
15
+
16
+ - Fixed CSRF vulnerability with non-session based authentication - [more info](https://github.com/ankane/pghero/issues/330)
17
+ - Added `database`, `user`, and `query_hash` options to `reset_query_stats` method
18
+
19
+ ## 2.6.0 (2020-07-09)
20
+
21
+ - Added support for Postgres 13 beta 2
22
+ - Added support for non-integer explain timeout
23
+
24
+ ## 2.5.1 (2020-06-23)
25
+
26
+ - Added support for `google-cloud-monitoring` >= 1
27
+ - Added support for `google-cloud-monitoring-v3`
28
+ - Fixed system stats not showing up in Rails 6 with environment variables
29
+
30
+ ## 2.5.0 (2020-05-24)
31
+
32
+ - Added system stats for Google Cloud SQL and Azure Database
33
+ - Added experimental `filter_data` option
34
+ - Localized times on maintenance page
35
+ - Improved connection pooling
36
+ - Improved error message for non-Postgres connections
37
+ - Fixed more deprecation warnings in Ruby 2.7
38
+
39
+ ## 2.4.2 (2020-04-16)
40
+
41
+ - Added `connections` method
42
+ - Fixed deprecation warnings in Ruby 2.7
43
+
44
+ ## 2.4.1 (2019-11-21)
45
+
46
+ - Fixed file permissions on `highlight.pack.js`
47
+
48
+ ## 2.4.0 (2019-11-11)
49
+
50
+ - Added `invalid_constraints` method
51
+ - Added `spec` option
52
+ - Added `override_csp` option
53
+ - Show all databases in Rails 6 when no config
54
+
55
+ ## 2.3.0 (2019-08-18)
56
+
57
+ - Added support for Postgres 12 beta 1
58
+ - Added methods and tasks for cleaning up stats
59
+ - Dropped support for Rails < 5
60
+
61
+ ## 2.2.1 (2019-06-04)
62
+
63
+ - Added `config_path` option
64
+ - Fixed error with sequences when temporary tables
65
+ - Fixed error when `config.action_controller.include_all_helpers = false`
66
+
67
+ ## 2.2.0 (2018-09-03)
68
+
69
+ - Added check for connections idle in transaction
70
+ - Improved duplicate index logic to detect more duplicates
71
+ - Don't report concurrent indexes in-progress as invalid on dashboard
72
+ - Fixed error with large number of sequences
73
+ - Bumped `total_connections_threshold` to 500 by default
74
+
75
+ ## 2.1.1 (2018-04-24)
76
+
77
+ - Added `explain_timeout_sec` option
78
+ - Fixed error with unparsable sequences
79
+ - Stopped throwing `Same sequence name in multiple schemas` error
80
+
81
+ ## 2.1.0 (2017-11-30)
82
+
83
+ - Fixed issue with sequences in different schema than table
84
+ - No longer throw errors for unreadable sequences
85
+ - Fixed replication lag for Amazon Aurora
86
+ - Added `vacuum_progress` method
87
+
88
+ ## 2.0.8 (2017-11-12)
89
+
90
+ - Added support for Postgres 10 replicas
91
+ - Added support for pg_query 1.0.0
92
+ - Show queries with insufficient privilege on live queries page
93
+ - Default to table schema for sequences
94
+
95
+ ## 2.0.7 (2017-10-28)
96
+
97
+ - Fixed issue with sequences in different schema than table
98
+ - Fixed query details when multiple users have same query hash
99
+ - Fixed error with invalid indexes in non-public schema
100
+ - Raise error when capture query stats fails
101
+
102
+ ## 2.0.6 (2017-09-24)
103
+
104
+ - More robust methods for multiple databases
105
+ - Added support for `RAILS_RELATIVE_URL_ROOT` for Linux and Docker
106
+
107
+ ## 2.0.5 (2017-09-14)
108
+
109
+ - Fixed error with sequences in different schemas
110
+ - Better advice
111
+
112
+ ## 2.0.4 (2017-08-28)
113
+
114
+ - Fixed `AssetNotPrecompiled` error
115
+ - Do not silently ignore sequence danger when user does not have permissions
116
+
117
+ ## 2.0.3 (2017-08-22)
118
+
119
+ - Added SQL to recreate invalid indexes
120
+ - Added unused index marker to Space page
121
+ - Fixed `capture_query_stats` on Postgres < 9.4
122
+
123
+ ## 2.0.2 (2017-08-09)
124
+
125
+ - Fixed error with suggested indexes
126
+ - Fixed error with `pg_replication_slots`
127
+
128
+ ## 2.0.1 (2017-08-08)
129
+
130
+ - Fixed capture space stats
131
+
132
+ ## 2.0.0 (2017-08-08)
133
+
134
+ New features
135
+
136
+ - Query details page
137
+ - Added check for inactive replication slots
138
+ - Added `table_sizes` method for full table sizes
139
+ - Added syntax highlighting
140
+ - Added `min_size` option to `analyze_tables`
141
+
142
+ Breaking changes
143
+
144
+ - Methods now return symbols for keys instead of strings
145
+ - Methods raise `PgHero::NotEnabled` error when a feature isn’t enabled
146
+ - Requires pg_query 0.9.0+ for suggested indexes
147
+ - Historical query stats require the `pghero_query_stats` table to have `query_hash` and `user` columns
148
+ - Removed `with` option - use:
149
+
150
+ ```ruby
151
+ PgHero.databases[:database2].running_queries
152
+ ```
153
+
154
+ instead of
155
+
156
+ ```ruby
157
+ PgHero.with(:database2) { PgHero.running_queries }
158
+ ```
159
+
160
+ - Removed options from `connection_sources` method
161
+ - Removed `locks` method
162
+
163
+ ## 1.7.0 (2017-05-01)
164
+
165
+ - Fixed migrations for Rails 5.1+
166
+ - Added `analyze`, `analyze_tables`, and `analyze_all` methods
167
+ - Added `pghero:analyze` rake task
168
+ - Fixed system stats display issue
169
+
170
+ ## 1.6.5 (2017-04-19)
171
+
172
+ - Added support for Rails API
173
+ - Added support for Amazon STS
174
+ - Fixed replica check when `hot_standby = on` for primary
175
+
176
+ ## 1.6.4 (2017-03-12)
177
+
178
+ - Only show connection charts if there are connections
179
+ - Fixed duplicate indexes for multiple schemas
180
+ - Fixed display issue for queries without word break
181
+ - Removed maintenance tab for replicas
182
+
183
+ ## 1.6.3 (2017-02-09)
184
+
185
+ - Added 10 second timeout for explain
186
+ - No longer show autovacuum in long running queries
187
+ - Added charts for connections
188
+ - Added new config format
189
+ - Removed Chartkick gem dependency for charts
190
+ - Fixed error when primary database is not PostgreSQL
191
+
192
+ ## 1.6.2 (2016-10-26)
193
+
194
+ - Suggest GiST over GIN for `LIKE` queries again (seeing better performance)
195
+
196
+ ## 1.6.1 (2016-10-24)
197
+
198
+ - Suggest GIN over GiST for `LIKE` queries
199
+
200
+ ## 1.6.0 (2016-10-20)
201
+
202
+ - Removed mostly inactionable items (cache hit rate and index usage)
203
+ - Restored duplicate indexes to homepage
204
+ - Fixed issue with exact duplicate indexes
205
+ - Way better `blocked_queries` method
206
+
207
+ ## 1.5.3 (2016-10-06)
208
+
209
+ - Fixed Rails 5 error with multiple databases
210
+ - Fixed duplicate index detection with expressions
211
+
212
+ ## 1.5.2 (2016-10-01)
213
+
214
+ - Added support for PostgreSQL 9.6
215
+ - Fixed incorrect query start for live queries in transactions
216
+
217
+ ## 1.5.1 (2016-09-27)
218
+
219
+ - Better tune page for PostgreSQL 9.5
220
+
221
+ ## 1.5.0 (2016-09-21)
222
+
223
+ - Added user to query stats (opt-in)
224
+ - Added user to connection sources
225
+ - Added `capture_space_stats` method and rake task
226
+ - Added visualize button to explain page
227
+ - Better charts for system stats
228
+
229
+ ## 1.4.2 (2016-09-06)
230
+
231
+ - Fixed `wrong constant name` error in development
232
+ - Added different periods for system stats
233
+
234
+ ## 1.4.1 (2016-08-25)
235
+
236
+ - Removed external assets
237
+
238
+ ## 1.4.0 (2016-08-24)
239
+
240
+ - Updated for Rails 5
241
+ - Fixed error when `pg_stat_statements` not enabled in `shared_libaries`
242
+
243
+ ## 1.3.2 (2016-08-03)
244
+
245
+ - Improved performance of query stats
246
+
247
+ ## 1.3.1 (2016-07-10)
248
+
249
+ - Improved grouping of query stats
250
+ - Added `blocked_queries` method
251
+
252
+ ## 1.3.0 (2016-06-27)
253
+
254
+ - Added query hash for better query stats grouping
255
+ - Added sequence danger check
256
+ - Added `capture_query_stats` option to config
257
+
258
+ ## 1.2.4 (2016-05-06)
259
+
260
+ - Fixed user methods
261
+
262
+ ## 1.2.3 (2016-04-20)
263
+
264
+ - Added schema to queries
265
+ - Fixed deprecation warning on Rails 5
266
+ - Fix for pg_query >= 0.9.0
267
+
268
+ ## 1.2.2 (2016-01-20)
269
+
270
+ - Better suggested indexes
271
+ - Removed duplicate indexes noise
272
+ - Fixed partial and expression indexes
273
+
274
+ ## 1.2.1 (2016-01-07)
275
+
276
+ - Better suggested indexes
277
+ - Removed unused indexes noise
278
+ - Removed autovacuum danger noise
279
+ - Removed maintenance tab
280
+ - Fixed suggested indexes for replicas
281
+ - Fixed issue w/ suggested indexes where same table name exists in multiple schemas
282
+
283
+ ## 1.2.0 (2015-12-31)
284
+
285
+ - Added suggested indexes
286
+ - Added duplicate indexes
287
+ - Added maintenance tab
288
+ - Added load stats for RDS
289
+ - Added `table_caching` and `index_caching` methods
290
+ - Added configurable cache hit rate threshold
291
+ - Show all connections in connections tab
292
+
293
+ ## 1.1.4 (2015-12-08)
294
+
295
+ - Added check for transaction ID wraparound failure
296
+ - Added check for autovacuum danger
297
+
298
+ ## 1.1.3 (2015-10-21)
299
+
300
+ - Fixed system stats
301
+
302
+ ## 1.1.2 (2015-10-18)
303
+
304
+ - Added invalid indexes
305
+ - Fixed RDS stats for aws-sdk 2
306
+
307
+ ## 1.1.1 (2015-07-23)
308
+
309
+ - Added `tables` option to `create_user` method
310
+ - Added ability to sort query stats by average_time and calls
311
+ - Only show unused indexes with no index scans in UI
312
+
313
+ ## 1.1.0 (2015-06-26)
314
+
315
+ - Added historical query stats
316
+
317
+ ## 1.0.1 (2015-04-17)
318
+
319
+ - Fixed connection bad errors
320
+ - Restore previous connection properly for nested with blocks
321
+ - Added analyze button to explain page
322
+ - Added explain button to live queries page
323
+
324
+ ## 1.0.0 (2015-04-11)
325
+
326
+ - More platforms!
327
+ - Support for multiple databases!
328
+ - Added `replica?` method
329
+ - Added `replication_lag` method
330
+ - Added `ssl_used?` method
331
+ - Added `kill_long_running_queries` method
332
+ - Added env vars for settings
333
+
334
+ ## 0.1.10 (2015-03-20)
335
+
336
+ - Added connections page
337
+ - Added message for insufficient privilege
338
+ - Added `ip` to `connection_sources`
339
+
340
+ ## 0.1.9 (2015-01-25)
341
+
342
+ - Added tune page
343
+ - Removed minimum size for unused indexes
344
+
345
+ ## 0.1.8 (2015-01-19)
346
+
347
+ - Added `total_percent` to `query_stats`
348
+ - Added `total_connections`
349
+ - Added `connection_stats` for Amazon RDS
350
+
351
+ ## 0.1.7 (2014-11-12)
352
+
353
+ - Added support for pg_stat_statments on Amazon RDS
354
+ - Added `long_running_query_sec`, `slow_query_ms` and `slow_query_calls` options
355
+
356
+ ## 0.1.6 (2014-10-09)
357
+
358
+ - Added methods to create and drop users
359
+ - Added locks
360
+
361
+ ## 0.1.5 (2014-09-03)
362
+
363
+ - Added system stats for Amazon RDS
364
+ - Added code to remove unused indexes
365
+ - Require unused indexes to be at least 1 MB
366
+ - Use `pg_terminate_backend` to ensure queries are killed
367
+
368
+ ## 0.1.4 (2014-08-31)
369
+
370
+ - Reduced long running queries threshold to 1 minute
371
+ - Fixed duration
372
+ - Fixed wrapping
373
+ - Friendlier dependencies for JRuby
374
+
375
+ ## 0.1.3 (2014-08-04)
376
+
377
+ - Reverted `query_stats_available?` fix
378
+
379
+ ## 0.1.2 (2014-08-03)
380
+
381
+ - Fixed `query_stats_available?` method
382
+
383
+ ## 0.1.1 (2014-08-03)
384
+
385
+ - Added explain
386
+ - Added query stats
387
+ - Fixed CSS issues
388
+
389
+ ## 0.1.0 (2014-07-23)
390
+
391
+ - First major release
@@ -0,0 +1,42 @@
1
+ # Contributing
2
+
3
+ First, thanks for wanting to contribute. You’re awesome! :heart:
4
+
5
+ ## Help
6
+
7
+ We’re not able to provide support through GitHub Issues. If you’re looking for help with your code, try posting on [Stack Overflow](https://stackoverflow.com/).
8
+
9
+ All features should be documented. If you don’t see a feature in the docs, assume it doesn’t exist.
10
+
11
+ ## Bugs
12
+
13
+ Think you’ve discovered a bug?
14
+
15
+ 1. Search existing issues to see if it’s been reported.
16
+ 2. Try the `master` branch to make sure it hasn’t been fixed.
17
+
18
+ ```rb
19
+ gem "pghero", github: "ankane/pghero"
20
+ ```
21
+
22
+ If the above steps don’t help, create an issue. Include:
23
+
24
+ - Detailed steps to reproduce
25
+ - Complete backtraces for exceptions
26
+
27
+ ## New Features
28
+
29
+ If you’d like to discuss a new feature, create an issue and start the title with `[Idea]`.
30
+
31
+ ## Pull Requests
32
+
33
+ Fork the project and create a pull request. A few tips:
34
+
35
+ - Keep changes to a minimum. If you have multiple features or fixes, submit multiple pull requests.
36
+ - Follow the existing style. The code should read like it’s written by a single person.
37
+
38
+ Feel free to open an issue to get feedback on your idea before spending too much time on it.
39
+
40
+ ---
41
+
42
+ This contributing guide is released under [CCO](https://creativecommons.org/publicdomain/zero/1.0/) (public domain). Use it for your own project without attribution.
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014-2019 Andrew Kane, 2008-2014 Heroku (initial queries)
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.