pghero 1.4.2 → 1.5.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +8 -8
- data/app/assets/javascripts/pghero/Chart.bundle.js +183 -55
- data/app/assets/javascripts/pghero/chartkick.js +53 -20
- data/app/assets/stylesheets/pghero/application.css +7 -0
- data/app/controllers/pg_hero/home_controller.rb +61 -57
- data/app/views/layouts/pg_hero/application.html.erb +3 -3
- data/app/views/pg_hero/home/_connections_table.html.erb +1 -1
- data/app/views/pg_hero/home/_queries_table.html.erb +6 -1
- data/app/views/pg_hero/home/connections.html.erb +1 -1
- data/app/views/pg_hero/home/explain.html.erb +11 -2
- data/app/views/pg_hero/home/index.html.erb +4 -4
- data/app/views/pg_hero/home/maintenance.html.erb +2 -2
- data/app/views/pg_hero/home/system.html.erb +2 -2
- data/guides/Rails.md +8 -0
- data/lib/generators/pghero/space_stats_generator.rb +29 -0
- data/lib/generators/pghero/templates/space_stats.rb +13 -0
- data/lib/pghero.rb +109 -23
- data/lib/pghero/database.rb +46 -8
- data/lib/pghero/engine.rb +3 -1
- data/lib/pghero/methods/basic.rb +3 -42
- data/lib/pghero/methods/connections.rb +18 -1
- data/lib/pghero/methods/explain.rb +2 -0
- data/lib/pghero/methods/indexes.rb +2 -2
- data/lib/pghero/methods/kill.rb +1 -1
- data/lib/pghero/methods/queries.rb +2 -2
- data/lib/pghero/methods/query_stats.rb +81 -75
- data/lib/pghero/methods/space.rb +12 -1
- data/lib/pghero/methods/suggested_indexes.rb +71 -31
- data/lib/pghero/version.rb +1 -1
- data/lib/tasks/pghero.rake +5 -0
- metadata +4 -3
- data/lib/pghero/methods/databases.rb +0 -39
data/lib/pghero/version.rb
CHANGED
data/lib/tasks/pghero.rake
CHANGED
@@ -4,6 +4,11 @@ namespace :pghero do
|
|
4
4
|
PgHero.capture_query_stats
|
5
5
|
end
|
6
6
|
|
7
|
+
desc "capture space stats"
|
8
|
+
task capture_space_stats: :environment do
|
9
|
+
PgHero.capture_space_stats
|
10
|
+
end
|
11
|
+
|
7
12
|
desc "autoindex"
|
8
13
|
task autoindex: :environment do
|
9
14
|
PgHero.autoindex_all(create: true)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pghero
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-09-
|
11
|
+
date: 2016-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -154,14 +154,15 @@ files:
|
|
154
154
|
- guides/Rails.md
|
155
155
|
- guides/Suggested-Indexes.md
|
156
156
|
- lib/generators/pghero/query_stats_generator.rb
|
157
|
+
- lib/generators/pghero/space_stats_generator.rb
|
157
158
|
- lib/generators/pghero/templates/query_stats.rb
|
159
|
+
- lib/generators/pghero/templates/space_stats.rb
|
158
160
|
- lib/pghero.rb
|
159
161
|
- lib/pghero/connection.rb
|
160
162
|
- lib/pghero/database.rb
|
161
163
|
- lib/pghero/engine.rb
|
162
164
|
- lib/pghero/methods/basic.rb
|
163
165
|
- lib/pghero/methods/connections.rb
|
164
|
-
- lib/pghero/methods/databases.rb
|
165
166
|
- lib/pghero/methods/explain.rb
|
166
167
|
- lib/pghero/methods/indexes.rb
|
167
168
|
- lib/pghero/methods/kill.rb
|
@@ -1,39 +0,0 @@
|
|
1
|
-
module PgHero
|
2
|
-
module Methods
|
3
|
-
module Databases
|
4
|
-
def databases
|
5
|
-
@databases ||= begin
|
6
|
-
Hash[
|
7
|
-
config["databases"].map do |id, c|
|
8
|
-
[id, PgHero::Database.new(id, c)]
|
9
|
-
end
|
10
|
-
]
|
11
|
-
end
|
12
|
-
end
|
13
|
-
|
14
|
-
def primary_database
|
15
|
-
databases.keys.first
|
16
|
-
end
|
17
|
-
|
18
|
-
def current_database
|
19
|
-
Thread.current[:pghero_current_database] ||= primary_database
|
20
|
-
end
|
21
|
-
|
22
|
-
def current_database=(database)
|
23
|
-
raise "Database not found" unless databases[database.to_s]
|
24
|
-
Thread.current[:pghero_current_database] = database.to_s
|
25
|
-
database
|
26
|
-
end
|
27
|
-
|
28
|
-
def with(database)
|
29
|
-
previous_database = current_database
|
30
|
-
begin
|
31
|
-
self.current_database = database
|
32
|
-
yield
|
33
|
-
ensure
|
34
|
-
self.current_database = previous_database
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|