pghero 2.8.0 → 2.8.3
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 +15 -0
- data/README.md +2 -2
- 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/layouts/pg_hero/application.html.erb +7 -2
- data/app/views/pg_hero/home/_live_queries_table.html.erb +10 -8
- 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/methods/suggested_indexes.rb +99 -26
- data/lib/pghero/methods/system.rb +31 -5
- 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] })
|
@@ -5,8 +5,13 @@
|
|
5
5
|
|
6
6
|
<meta charset="utf-8" />
|
7
7
|
<%= favicon_link_tag "pghero/favicon.png" %>
|
8
|
-
|
9
|
-
|
8
|
+
<% if defined?(Propshaft::Railtie) %>
|
9
|
+
<%= stylesheet_link_tag "pghero/nouislider", "pghero/arduino-light", "pghero/application" %>
|
10
|
+
<%= javascript_include_tag "pghero/jquery", "pghero/nouislider", "pghero/Chart.bundle", "pghero/chartkick", "pghero/highlight.pack", "pghero/application" %>
|
11
|
+
<% else %>
|
12
|
+
<%= stylesheet_link_tag "pghero/application" %>
|
13
|
+
<%= javascript_include_tag "pghero/application" %>
|
14
|
+
<% end %>
|
10
15
|
</head>
|
11
16
|
<body>
|
12
17
|
<div class="container">
|
@@ -12,14 +12,16 @@
|
|
12
12
|
<tr>
|
13
13
|
<td><%= query[:pid] %></td>
|
14
14
|
<td>
|
15
|
-
<%
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
<%
|
22
|
-
|
15
|
+
<% if query[:duration_ms] %>
|
16
|
+
<% sec = query[:duration_ms] / 1000.0 %>
|
17
|
+
<% if sec < 1.minute %>
|
18
|
+
<%= sec.round(1) %> s
|
19
|
+
<% elsif sec < 1.day %>
|
20
|
+
<%= Time.at(sec).utc.strftime("%H:%M:%S") %>
|
21
|
+
<% else %>
|
22
|
+
<% days = (sec / 1.day).floor %>
|
23
|
+
<%= days %>d <%= Time.at(sec - days.days).utc.strftime("%H:%M:%S") %>
|
24
|
+
<% end %>
|
23
25
|
<% end %>
|
24
26
|
</td>
|
25
27
|
<td>
|
@@ -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
|
@@ -201,36 +201,69 @@ module PgHero
|
|
201
201
|
rescue PgQuery::ParseError
|
202
202
|
return {error: "Parse error"}
|
203
203
|
end
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
204
|
+
|
205
|
+
if PgQuery::VERSION.to_i >= 2
|
206
|
+
return {error: "Unknown structure"} unless tree.stmts.size == 1
|
207
|
+
|
208
|
+
tree = tree.stmts.first.stmt
|
209
|
+
|
210
|
+
table = parse_table_v2(tree) rescue nil
|
211
|
+
unless table
|
212
|
+
error =
|
213
|
+
case tree.node
|
214
|
+
when :insert_stmt
|
215
|
+
"INSERT statement"
|
216
|
+
when :variable_set_stmt
|
217
|
+
"SET statement"
|
218
|
+
when :select_stmt
|
219
|
+
if (tree.select_stmt.from_clause.first.join_expr rescue false)
|
220
|
+
"JOIN not supported yet"
|
221
|
+
end
|
222
222
|
end
|
223
|
-
|
224
|
-
|
225
|
-
|
223
|
+
return {error: error || "Unknown structure"}
|
224
|
+
end
|
225
|
+
|
226
|
+
select = tree[tree.node.to_s]
|
227
|
+
where = (select.where_clause ? parse_where_v2(select.where_clause) : []) rescue nil
|
228
|
+
return {error: "Unknown structure"} unless where
|
229
|
+
|
230
|
+
sort = (select.sort_clause ? parse_sort_v2(select.sort_clause) : []) rescue []
|
231
|
+
|
232
|
+
{table: table, where: where, sort: sort}
|
233
|
+
else
|
234
|
+
# TODO remove support for pg_query < 2 in PgHero 3.0
|
235
|
+
|
236
|
+
return {error: "Unknown structure"} unless tree.size == 1
|
237
|
+
|
238
|
+
tree = tree.first
|
239
|
+
|
240
|
+
# pg_query 1.0.0
|
241
|
+
tree = tree["RawStmt"]["stmt"] if tree["RawStmt"]
|
242
|
+
|
243
|
+
table = parse_table(tree) rescue nil
|
244
|
+
unless table
|
245
|
+
error =
|
246
|
+
case tree.keys.first
|
247
|
+
when "InsertStmt"
|
248
|
+
"INSERT statement"
|
249
|
+
when "VariableSetStmt"
|
250
|
+
"SET statement"
|
251
|
+
when "SelectStmt"
|
252
|
+
if (tree["SelectStmt"]["fromClause"].first["JoinExpr"] rescue false)
|
253
|
+
"JOIN not supported yet"
|
254
|
+
end
|
255
|
+
end
|
256
|
+
return {error: error || "Unknown structure"}
|
257
|
+
end
|
226
258
|
|
227
|
-
|
228
|
-
|
229
|
-
|
259
|
+
select = tree.values.first
|
260
|
+
where = (select["whereClause"] ? parse_where(select["whereClause"]) : []) rescue nil
|
261
|
+
return {error: "Unknown structure"} unless where
|
230
262
|
|
231
|
-
|
263
|
+
sort = (select["sortClause"] ? parse_sort(select["sortClause"]) : []) rescue []
|
232
264
|
|
233
|
-
|
265
|
+
{table: table, where: where, sort: sort}
|
266
|
+
end
|
234
267
|
end
|
235
268
|
|
236
269
|
# TODO better row estimation
|
@@ -267,6 +300,17 @@ module PgHero
|
|
267
300
|
end
|
268
301
|
end
|
269
302
|
|
303
|
+
def parse_table_v2(tree)
|
304
|
+
case tree.node
|
305
|
+
when :select_stmt
|
306
|
+
tree.select_stmt.from_clause.first.range_var.relname
|
307
|
+
when :delete_stmt
|
308
|
+
tree.delete_stmt.relation.relname
|
309
|
+
when :update_stmt
|
310
|
+
tree.update_stmt.relation.relname
|
311
|
+
end
|
312
|
+
end
|
313
|
+
|
270
314
|
def parse_table(tree)
|
271
315
|
case tree.keys.first
|
272
316
|
when "SelectStmt"
|
@@ -278,6 +322,26 @@ module PgHero
|
|
278
322
|
end
|
279
323
|
end
|
280
324
|
|
325
|
+
# TODO capture values
|
326
|
+
def parse_where_v2(tree)
|
327
|
+
aexpr = tree.a_expr
|
328
|
+
|
329
|
+
if tree.bool_expr
|
330
|
+
if tree.bool_expr.boolop == :AND_EXPR
|
331
|
+
tree.bool_expr.args.flat_map { |v| parse_where_v2(v) }
|
332
|
+
else
|
333
|
+
raise "Not Implemented"
|
334
|
+
end
|
335
|
+
elsif aexpr && ["=", "<>", ">", ">=", "<", "<=", "~~", "~~*", "BETWEEN"].include?(aexpr.name.first.string.str)
|
336
|
+
[{column: aexpr.lexpr.column_ref.fields.last.string.str, op: aexpr.name.first.string.str}]
|
337
|
+
elsif tree.null_test
|
338
|
+
op = tree.null_test.nulltesttype == :IS_NOT_NULL ? "not_null" : "null"
|
339
|
+
[{column: tree.null_test.arg.column_ref.fields.last.string.str, op: op}]
|
340
|
+
else
|
341
|
+
raise "Not Implemented"
|
342
|
+
end
|
343
|
+
end
|
344
|
+
|
281
345
|
# TODO capture values
|
282
346
|
def parse_where(tree)
|
283
347
|
aexpr = tree["A_Expr"]
|
@@ -298,6 +362,15 @@ module PgHero
|
|
298
362
|
end
|
299
363
|
end
|
300
364
|
|
365
|
+
def parse_sort_v2(sort_clause)
|
366
|
+
sort_clause.map do |v|
|
367
|
+
{
|
368
|
+
column: v.sort_by.node.column_ref.fields.last.string.str,
|
369
|
+
direction: v.sort_by.sortby_dir == :SORTBY_DESC ? "desc" : "asc"
|
370
|
+
}
|
371
|
+
end
|
372
|
+
end
|
373
|
+
|
301
374
|
def parse_sort(sort_clause)
|
302
375
|
sort_clause.map do |v|
|
303
376
|
{
|
@@ -133,8 +133,6 @@ module PgHero
|
|
133
133
|
private
|
134
134
|
|
135
135
|
def gcp_stats(metric_name, duration: nil, period: nil, offset: nil, series: false)
|
136
|
-
require "google/cloud/monitoring/v3"
|
137
|
-
|
138
136
|
# TODO DRY with RDS stats
|
139
137
|
duration = (duration || 1.hour).to_i
|
140
138
|
period = (period || 1.minute).to_i
|
@@ -146,10 +144,20 @@ module PgHero
|
|
146
144
|
raise Error, "Invalid metric name" unless metric_name =~ /\A[a-z\/_]+\z/i
|
147
145
|
raise Error, "Invalid database id" unless gcp_database_id =~ /\A[a-z0-9\-:]+\z/i
|
148
146
|
|
149
|
-
# we handle
|
147
|
+
# we handle four situations:
|
150
148
|
# 1. google-cloud-monitoring-v3
|
151
149
|
# 2. google-cloud-monitoring >= 1
|
152
150
|
# 3. google-cloud-monitoring < 1
|
151
|
+
# 4. google-apis-monitoring_v3
|
152
|
+
begin
|
153
|
+
require "google/cloud/monitoring/v3"
|
154
|
+
rescue LoadError
|
155
|
+
begin
|
156
|
+
require "google/cloud/monitoring"
|
157
|
+
rescue LoadError
|
158
|
+
require "google/apis/monitoring_v3"
|
159
|
+
end
|
160
|
+
end
|
153
161
|
|
154
162
|
# for situations 1 and 2
|
155
163
|
# Google::Cloud::Monitoring.metric_service is documented
|
@@ -175,7 +183,7 @@ module PgHero
|
|
175
183
|
view: Google::Cloud::Monitoring::V3::ListTimeSeriesRequest::TimeSeriesView::FULL,
|
176
184
|
aggregation: aggregation
|
177
185
|
})
|
178
|
-
|
186
|
+
elsif defined?(Google::Cloud::Monitoring)
|
179
187
|
require "google/cloud/monitoring"
|
180
188
|
|
181
189
|
client = Google::Cloud::Monitoring::Metric.new
|
@@ -198,13 +206,31 @@ module PgHero
|
|
198
206
|
Google::Monitoring::V3::ListTimeSeriesRequest::TimeSeriesView::FULL,
|
199
207
|
aggregation: aggregation
|
200
208
|
)
|
209
|
+
else
|
210
|
+
client = Google::Apis::MonitoringV3::MonitoringService.new
|
211
|
+
|
212
|
+
scope = Google::Apis::MonitoringV3::AUTH_MONITORING_READ
|
213
|
+
client.authorization = Google::Auth.get_application_default([scope])
|
214
|
+
|
215
|
+
# default logging is very verbose, but use app default
|
216
|
+
results = client.list_project_time_series(
|
217
|
+
"projects/#{gcp_database_id.split(":").first}",
|
218
|
+
filter: "metric.type = \"cloudsql.googleapis.com/database/#{metric_name}\" AND resource.label.database_id = \"#{gcp_database_id}\"",
|
219
|
+
interval_start_time: (start_time - period).iso8601,
|
220
|
+
interval_end_time: end_time.iso8601,
|
221
|
+
view: 0, # full
|
222
|
+
aggregation_alignment_period: "#{period}s",
|
223
|
+
aggregation_per_series_aligner: 12 # mean
|
224
|
+
).time_series
|
201
225
|
end
|
202
226
|
|
203
227
|
data = {}
|
204
228
|
result = results.first
|
205
229
|
if result
|
206
230
|
result.points.each do |point|
|
207
|
-
time =
|
231
|
+
time = point.interval.start_time
|
232
|
+
# string with google-apis-monitoring_v3
|
233
|
+
time = time.is_a?(String) ? Time.parse(time) : Time.at(time.seconds)
|
208
234
|
value = point.value.double_value
|
209
235
|
value *= 100 if metric_name == "cpu/utilization"
|
210
236
|
data[time] = value
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-05-02 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.
|
126
|
+
rubygems_version: 3.3.7
|
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.
|