pghero 2.8.1 → 2.8.2
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 +5 -0
- data/README.md +1 -1
- data/app/assets/javascripts/pghero/Chart.bundle.js +22931 -19988
- data/app/assets/javascripts/pghero/chartkick.js +317 -253
- data/app/controllers/pg_hero/home_controller.rb +10 -6
- data/app/views/pg_hero/home/index.html.erb +1 -1
- data/app/views/pg_hero/home/relation_space.html.erb +1 -1
- data/app/views/pg_hero/home/show_query.html.erb +3 -3
- data/app/views/pg_hero/home/space.html.erb +4 -4
- data/app/views/pg_hero/home/system.html.erb +4 -4
- data/lib/pghero/database.rb +1 -1
- data/lib/pghero/version.rb +1 -1
- data/lib/pghero.rb +8 -2
- data/licenses/LICENSE-chart.js.txt +1 -1
- data/licenses/LICENSE-chartjs-adapter-date-fns.txt +9 -0
- data/licenses/LICENSE-chartkick.js.txt +1 -1
- data/licenses/LICENSE-date-fns.txt +20 -0
- metadata +5 -4
- data/licenses/LICENSE-moment.txt +0 -22
@@ -79,19 +79,23 @@ module PgHero
|
|
79
79
|
@title = "Space"
|
80
80
|
@days = (params[:days] || 7).to_i
|
81
81
|
@database_size = @database.database_size
|
82
|
-
@
|
83
|
-
@
|
82
|
+
@only_tables = params[:tables].present?
|
83
|
+
@relation_sizes = @only_tables ? @database.table_sizes : @database.relation_sizes
|
84
|
+
@space_stats_enabled = @database.space_stats_enabled? && !@only_tables
|
84
85
|
if @space_stats_enabled
|
85
86
|
space_growth = @database.space_growth(days: @days, relation_sizes: @relation_sizes)
|
86
87
|
@growth_bytes_by_relation = Hash[ space_growth.map { |r| [[r[:schema], r[:relation]], r[:growth_bytes]] } ]
|
87
|
-
|
88
|
-
when "growth"
|
88
|
+
if params[:sort] == "growth"
|
89
89
|
@relation_sizes.sort_by! { |r| s = @growth_bytes_by_relation[[r[:schema], r[:relation]]]; [s ? 0 : 1, -s.to_i, r[:schema], r[:relation]] }
|
90
|
-
when "name"
|
91
|
-
@relation_sizes.sort_by! { |r| r[:relation] || r[:table] }
|
92
90
|
end
|
93
91
|
end
|
94
92
|
|
93
|
+
if params[:sort] == "name"
|
94
|
+
@relation_sizes.sort_by! { |r| r[:relation] || r[:table] }
|
95
|
+
end
|
96
|
+
|
97
|
+
@header_options = @only_tables ? {tables: "t"} : {}
|
98
|
+
|
95
99
|
across = params[:across].to_s.split(",")
|
96
100
|
@unused_indexes = @database.unused_indexes(max_scans: 0, across: across)
|
97
101
|
@unused_index_names = Set.new(@unused_indexes.map { |r| r[:index] })
|
@@ -221,7 +221,7 @@
|
|
221
221
|
<h1>High Number of Connections</h1>
|
222
222
|
<p><%= pluralize(@total_connections, "connection") %></p>
|
223
223
|
|
224
|
-
<p><%= link_to "Use connection pooling", "
|
224
|
+
<p><%= link_to "Use connection pooling", "https://www.craigkerstiens.com/2014/05/22/postgres-and-connection-pooling/", target: "_blank" %> for better performance. <%= link_to "PgBouncer", "https://wiki.postgresql.org/wiki/PgBouncer", target: "_blank" %> is a solid option.</p>
|
225
225
|
|
226
226
|
<%= render partial: "connections_table", locals: {connection_sources: @database.connection_sources.first(10)} %>
|
227
227
|
</div>
|
@@ -9,6 +9,6 @@
|
|
9
9
|
<h1>Size</h1>
|
10
10
|
<div id="chart-1" class="chart" style="margin-bottom: 20px;">Loading...</div>
|
11
11
|
<script>
|
12
|
-
new Chartkick.LineChart("chart-1", <%= json_escape(@chart_data.to_json).html_safe %>, {colors: ["#5bc0de"], legend: false, min: null, bytes: true, library: {
|
12
|
+
new Chartkick.LineChart("chart-1", <%= json_escape(@chart_data.to_json).html_safe %>, {colors: ["#5bc0de"], legend: false, min: null, bytes: true, library: {plugins: {tooltip: {intersect: false, mode: "index"}}}})
|
13
13
|
</script>
|
14
14
|
</div>
|
@@ -49,19 +49,19 @@
|
|
49
49
|
<h1>Total Time <small>ms</small></h1>
|
50
50
|
<div id="chart-1" class="chart" style="margin-bottom: 20px;">Loading...</div>
|
51
51
|
<script>
|
52
|
-
new Chartkick.LineChart("chart-1", <%= json_escape(@chart_data.to_json).html_safe %>, {colors: ["#5bc0de"], legend: false, library: {
|
52
|
+
new Chartkick.LineChart("chart-1", <%= json_escape(@chart_data.to_json).html_safe %>, {colors: ["#5bc0de"], legend: false, library: {plugins: {tooltip: {intersect: false, mode: "index"}}}})
|
53
53
|
</script>
|
54
54
|
|
55
55
|
<h1>Average Time <small>ms</small></h1>
|
56
56
|
<div id="chart-2" class="chart" style="margin-bottom: 20px;">Loading...</div>
|
57
57
|
<script>
|
58
|
-
new Chartkick.LineChart("chart-2", <%= json_escape(@chart2_data.to_json).html_safe %>, {colors: ["#5bc0de"], legend: false, library: {
|
58
|
+
new Chartkick.LineChart("chart-2", <%= json_escape(@chart2_data.to_json).html_safe %>, {colors: ["#5bc0de"], legend: false, library: {plugins: {tooltip: {intersect: false, mode: "index"}}}})
|
59
59
|
</script>
|
60
60
|
|
61
61
|
<h1>Calls</h1>
|
62
62
|
<div id="chart-3" class="chart" style="margin-bottom: 20px;">Loading...</div>
|
63
63
|
<script>
|
64
|
-
new Chartkick.LineChart("chart-3", <%= json_escape(@chart3_data.to_json).html_safe %>, {colors: ["#5bc0de"], legend: false, library: {
|
64
|
+
new Chartkick.LineChart("chart-3", <%= json_escape(@chart3_data.to_json).html_safe %>, {colors: ["#5bc0de"], legend: false, library: {plugins: {tooltip: {intersect: false, mode: "index"}}}})
|
65
65
|
</script>
|
66
66
|
<% else %>
|
67
67
|
<p>
|
@@ -6,7 +6,7 @@
|
|
6
6
|
<% if @system_stats_enabled %>
|
7
7
|
<div id="chart-1" class="chart" style="margin-bottom: 20px;">Loading...</div>
|
8
8
|
<script>
|
9
|
-
new Chartkick.LineChart("chart-1", <%= json_escape(free_space_stats_path.to_json).html_safe %>, {colors: ["#5bc0de"], bytes: true, library: {
|
9
|
+
new Chartkick.LineChart("chart-1", <%= json_escape(free_space_stats_path.to_json).html_safe %>, {colors: ["#5bc0de"], bytes: true, library: {plugins: {tooltip: {intersect: false, mode: "index"}}}})
|
10
10
|
</script>
|
11
11
|
<% end %>
|
12
12
|
|
@@ -40,10 +40,10 @@
|
|
40
40
|
<table class="table space-table">
|
41
41
|
<thead>
|
42
42
|
<tr>
|
43
|
-
<th><%= link_to "Relation",
|
44
|
-
<th style="width: 15%;"><%= link_to "Size",
|
43
|
+
<th><%= link_to (@only_tables ? "Table" : "Relation"), @header_options.merge(sort: "name") %></th>
|
44
|
+
<th style="width: 15%;"><%= link_to "Size", @header_options %></th>
|
45
45
|
<% if @space_stats_enabled %>
|
46
|
-
<th style="width: 15%;"><%= link_to "#{@days}d Growth",
|
46
|
+
<th style="width: 15%;"><%= link_to "#{@days}d Growth", @header_options.merge(sort: "growth") %></th>
|
47
47
|
<% end %>
|
48
48
|
</tr>
|
49
49
|
</thead>
|
@@ -9,26 +9,26 @@
|
|
9
9
|
<h1>CPU</h1>
|
10
10
|
<div id="chart-1" class="chart" style="margin-bottom: 20px;">Loading...</div>
|
11
11
|
<script>
|
12
|
-
new Chartkick.LineChart("chart-1", <%= json_escape(cpu_usage_path(path_options).to_json).html_safe %>, {max: 100, colors: ["#5bc0de"], suffix: "%", library: {
|
12
|
+
new Chartkick.LineChart("chart-1", <%= json_escape(cpu_usage_path(path_options).to_json).html_safe %>, {max: 100, colors: ["#5bc0de"], suffix: "%", library: {plugins: {tooltip: {intersect: false, mode: "index"}}}})
|
13
13
|
</script>
|
14
14
|
|
15
15
|
<h1>Load</h1>
|
16
16
|
<div id="chart-2" class="chart" style="margin-bottom: 20px;">Loading...</div>
|
17
17
|
<script>
|
18
|
-
new Chartkick.LineChart("chart-2", <%= json_escape(load_stats_path(path_options).to_json).html_safe %>, {colors: ["#5bc0de", "#d9534f"], library: {
|
18
|
+
new Chartkick.LineChart("chart-2", <%= json_escape(load_stats_path(path_options).to_json).html_safe %>, {colors: ["#5bc0de", "#d9534f"], library: {plugins: {tooltip: {intersect: false, mode: "nearest"}}}})
|
19
19
|
</script>
|
20
20
|
|
21
21
|
<h1>Connections</h1>
|
22
22
|
<div id="chart-3" class="chart" style="margin-bottom: 20px;">Loading...</div>
|
23
23
|
<script>
|
24
|
-
new Chartkick.LineChart("chart-3", <%= json_escape(connection_stats_path(path_options).to_json).html_safe %>, {colors: ["#5bc0de"], library: {
|
24
|
+
new Chartkick.LineChart("chart-3", <%= json_escape(connection_stats_path(path_options).to_json).html_safe %>, {colors: ["#5bc0de"], library: {plugins: {tooltip: {intersect: false, mode: "index"}}}})
|
25
25
|
</script>
|
26
26
|
|
27
27
|
<% if @database.replica? %>
|
28
28
|
<h1>Replication Lag</h1>
|
29
29
|
<div id="chart-4" class="chart" style="margin-bottom: 20px;">Loading...</div>
|
30
30
|
<script>
|
31
|
-
new Chartkick.LineChart("chart-4", <%= json_escape(replication_lag_stats_path(path_options).to_json).html_safe %>, {colors: ["#5bc0de"], library: {
|
31
|
+
new Chartkick.LineChart("chart-4", <%= json_escape(replication_lag_stats_path(path_options).to_json).html_safe %>, {colors: ["#5bc0de"], library: {plugins: {tooltip: {intersect: false, mode: "index"}}}})
|
32
32
|
</script>
|
33
33
|
<% end %>
|
34
34
|
</div>
|
data/lib/pghero/database.rb
CHANGED
@@ -149,7 +149,7 @@ module PgHero
|
|
149
149
|
# resolve spec
|
150
150
|
if !url && config["spec"]
|
151
151
|
raise Error, "Spec requires Rails 6+" unless PgHero.spec_supported?
|
152
|
-
config_options = {env_name: PgHero.env, PgHero.spec_name_key => config["spec"],
|
152
|
+
config_options = {env_name: PgHero.env, PgHero.spec_name_key => config["spec"], PgHero.include_replicas_key => true}
|
153
153
|
resolved = ActiveRecord::Base.configurations.configs_for(**config_options)
|
154
154
|
raise Error, "Spec not found: #{config["spec"]}" unless resolved
|
155
155
|
url = ActiveRecord::VERSION::STRING.to_f >= 6.1 ? resolved.configuration_hash : resolved.config
|
data/lib/pghero/version.rb
CHANGED
data/lib/pghero.rb
CHANGED
@@ -112,7 +112,7 @@ module PgHero
|
|
112
112
|
databases = {}
|
113
113
|
|
114
114
|
if !ENV["PGHERO_DATABASE_URL"] && spec_supported?
|
115
|
-
ActiveRecord::Base.configurations.configs_for(env_name: env,
|
115
|
+
ActiveRecord::Base.configurations.configs_for(env_name: env, include_replicas_key => true).each do |db|
|
116
116
|
databases[db.send(spec_name_key)] = {"spec" => db.send(spec_name_key)}
|
117
117
|
end
|
118
118
|
end
|
@@ -217,12 +217,18 @@ module PgHero
|
|
217
217
|
end
|
218
218
|
|
219
219
|
# private
|
220
|
-
# Rails 6.1
|
220
|
+
# Rails 6.1 deprecates `spec_name` for `name`
|
221
221
|
# https://github.com/rails/rails/pull/38536
|
222
222
|
def spec_name_key
|
223
223
|
ActiveRecord::VERSION::STRING.to_f >= 6.1 ? :name : :spec_name
|
224
224
|
end
|
225
225
|
|
226
|
+
# private
|
227
|
+
# Rails 7.0 deprecates `include_replicas` for `include_hidden`
|
228
|
+
def include_replicas_key
|
229
|
+
ActiveRecord::VERSION::MAJOR >= 7 ? :include_hidden : :include_replicas
|
230
|
+
end
|
231
|
+
|
226
232
|
private
|
227
233
|
|
228
234
|
def each_database
|
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c)
|
3
|
+
Copyright (c) 2014-2021 Chart.js Contributors
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
6
|
|
@@ -0,0 +1,9 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Chart.js Contributors
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
6
|
+
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
8
|
+
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (C) 2020 Sasha Koss and Lesha Koss
|
2
|
+
|
3
|
+
# License
|
4
|
+
|
5
|
+
date-fns is licensed under the [MIT license](http://kossnocorp.mit-license.org).
|
6
|
+
Read more about MIT at [TLDRLegal](https://tldrlegal.com/license/mit-license).
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
Text from http://kossnocorp.mit-license.org
|
11
|
+
|
12
|
+
The MIT License (MIT)
|
13
|
+
|
14
|
+
Copyright © 2021 Sasha Koss
|
15
|
+
|
16
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
17
|
+
|
18
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
19
|
+
|
20
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
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: 2.8.
|
4
|
+
version: 2.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-12-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -98,10 +98,11 @@ files:
|
|
98
98
|
- lib/pghero/version.rb
|
99
99
|
- lib/tasks/pghero.rake
|
100
100
|
- licenses/LICENSE-chart.js.txt
|
101
|
+
- licenses/LICENSE-chartjs-adapter-date-fns.txt
|
101
102
|
- licenses/LICENSE-chartkick.js.txt
|
103
|
+
- licenses/LICENSE-date-fns.txt
|
102
104
|
- licenses/LICENSE-highlight.js.txt
|
103
105
|
- licenses/LICENSE-jquery.txt
|
104
|
-
- licenses/LICENSE-moment.txt
|
105
106
|
- licenses/LICENSE-nouislider.txt
|
106
107
|
homepage: https://github.com/ankane/pghero
|
107
108
|
licenses:
|
@@ -122,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
123
|
- !ruby/object:Gem::Version
|
123
124
|
version: '0'
|
124
125
|
requirements: []
|
125
|
-
rubygems_version: 3.2.
|
126
|
+
rubygems_version: 3.2.32
|
126
127
|
signing_key:
|
127
128
|
specification_version: 4
|
128
129
|
summary: A performance dashboard for Postgres
|
data/licenses/LICENSE-moment.txt
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) JS Foundation and other contributors
|
2
|
-
|
3
|
-
Permission is hereby granted, free of charge, to any person
|
4
|
-
obtaining a copy of this software and associated documentation
|
5
|
-
files (the "Software"), to deal in the Software without
|
6
|
-
restriction, including without limitation the rights to use,
|
7
|
-
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
-
copies of the Software, and to permit persons to whom the
|
9
|
-
Software is furnished to do so, subject to the following
|
10
|
-
conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be
|
13
|
-
included in all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
17
|
-
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
19
|
-
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
20
|
-
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
21
|
-
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
22
|
-
OTHER DEALINGS IN THE SOFTWARE.
|