pghero 3.6.0 → 3.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/app/views/layouts/pg_hero/application.html.erb +1 -1
- data/lib/pghero/database.rb +1 -1
- data/lib/pghero/engine.rb +2 -2
- data/lib/pghero/methods/basic.rb +19 -21
- data/lib/pghero/methods/suggested_indexes.rb +3 -1
- data/lib/pghero/version.rb +1 -1
- data/lib/pghero.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7dc52d94fbdd96a3efcef37d4739855cb5e9ab0da76c53d345141c3a0f28021
|
4
|
+
data.tar.gz: 6e1640fb5ff339f5d0523d7acebb4655c0426b877a2a6545e53fb0af386769da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d1ad10cfe918c2ab278af7aa96fcf5b08ccce3b6454f9630d7a628c9be0d54d0d3f5110d9ec4ab9248ee42556bba66166347412d284074820ed35069292ce72f
|
7
|
+
data.tar.gz: 4a7cc686fb1074c827a21e5b9ee8ce5a82119926b05e9ea8cdacd31759765932767df2638bd0790543e5f252507c97863c9572be7112be22244927396d93dce7
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
|
+
## 3.6.1 (2024-10-14)
|
2
|
+
|
3
|
+
- Fixed error when Propshaft is installed but not used
|
4
|
+
|
1
5
|
## 3.6.0 (2024-07-10)
|
2
6
|
|
3
7
|
- Improved CSP support
|
8
|
+
- Dropped support for Linux packages for Ubuntu 18.04, CentOS 7, and SLES 12
|
4
9
|
- Dropped support for Ruby < 3.1 and Rails < 6.1
|
5
10
|
|
6
11
|
## 3.5.0 (2024-05-21)
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
<meta charset="utf-8" />
|
7
7
|
<%= favicon_link_tag "pghero/favicon.png" %>
|
8
|
-
<% if defined?(Propshaft::Railtie) %>
|
8
|
+
<% if defined?(Propshaft::Railtie) && Rails.application.assets.is_a?(Propshaft::Assembly) %>
|
9
9
|
<%= stylesheet_link_tag "pghero/nouislider", "pghero/arduino-light", "pghero/application" %>
|
10
10
|
<%= javascript_include_tag "pghero/jquery", "pghero/nouislider", "pghero/Chart.bundle", "pghero/chartkick", "pghero/highlight.min", "pghero/application", nonce: true %>
|
11
11
|
<% else %>
|
data/lib/pghero/database.rb
CHANGED
@@ -126,7 +126,7 @@ module PgHero
|
|
126
126
|
# rough check for Postgres adapter
|
127
127
|
# keep this message generic so it's useful
|
128
128
|
# when empty url set in Docker image pghero.yml
|
129
|
-
unless @connection_model.
|
129
|
+
unless @connection_model.connection_db_config.adapter.to_s.match?(/postg/i)
|
130
130
|
raise Error, "Invalid connection URL"
|
131
131
|
end
|
132
132
|
@adapter_checked = true
|
data/lib/pghero/engine.rb
CHANGED
@@ -4,8 +4,8 @@ module PgHero
|
|
4
4
|
|
5
5
|
initializer "pghero", group: :all do |app|
|
6
6
|
# check if Rails api mode
|
7
|
-
if app.config.respond_to?(:assets)
|
8
|
-
if
|
7
|
+
if app.config.respond_to?(:assets) && defined?(Sprockets)
|
8
|
+
if Sprockets::VERSION.to_i >= 4
|
9
9
|
app.config.assets.precompile << "pghero/application.js"
|
10
10
|
app.config.assets.precompile << "pghero/application.css"
|
11
11
|
app.config.assets.precompile << "pghero/favicon.png"
|
data/lib/pghero/methods/basic.rb
CHANGED
@@ -31,13 +31,18 @@ module PgHero
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def quote_ident(value)
|
34
|
-
|
34
|
+
with_connection { |c| c.quote_column_name(value) }
|
35
35
|
end
|
36
36
|
|
37
37
|
private
|
38
38
|
|
39
|
-
def select_all(sql,
|
40
|
-
|
39
|
+
def select_all(sql, stats: false, query_columns: [])
|
40
|
+
with_connection(stats: stats) do |conn|
|
41
|
+
select_all_leased(sql, conn: conn, query_columns: query_columns)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def select_all_leased(sql, conn:, query_columns:)
|
41
46
|
# squish for logs
|
42
47
|
retries = 0
|
43
48
|
begin
|
@@ -81,7 +86,7 @@ module PgHero
|
|
81
86
|
end
|
82
87
|
|
83
88
|
def select_all_stats(sql, **options)
|
84
|
-
select_all(sql, **options,
|
89
|
+
select_all(sql, **options, stats: true)
|
85
90
|
end
|
86
91
|
|
87
92
|
def select_all_size(sql)
|
@@ -92,24 +97,17 @@ module PgHero
|
|
92
97
|
result
|
93
98
|
end
|
94
99
|
|
95
|
-
def select_one(sql
|
96
|
-
select_all(sql
|
97
|
-
end
|
98
|
-
|
99
|
-
def select_one_stats(sql)
|
100
|
-
select_one(sql, conn: stats_connection)
|
100
|
+
def select_one(sql)
|
101
|
+
select_all(sql).first.values.first
|
101
102
|
end
|
102
103
|
|
103
104
|
def execute(sql)
|
104
|
-
|
105
|
-
end
|
106
|
-
|
107
|
-
def connection
|
108
|
-
connection_model.connection
|
105
|
+
with_connection { |c| c.execute(add_source(sql)) }
|
109
106
|
end
|
110
107
|
|
111
|
-
def
|
112
|
-
::PgHero::Stats
|
108
|
+
def with_connection(stats: false, &block)
|
109
|
+
model = stats ? ::PgHero::Stats : connection_model
|
110
|
+
model.connection_pool.with_connection(&block)
|
113
111
|
end
|
114
112
|
|
115
113
|
def squish(str)
|
@@ -121,15 +119,15 @@ module PgHero
|
|
121
119
|
end
|
122
120
|
|
123
121
|
def quote(value)
|
124
|
-
|
122
|
+
with_connection { |c| c.quote(value) }
|
125
123
|
end
|
126
124
|
|
127
125
|
def quote_table_name(value)
|
128
|
-
|
126
|
+
with_connection { |c| c.quote_table_name(value) }
|
129
127
|
end
|
130
128
|
|
131
129
|
def quote_column_name(value)
|
132
|
-
|
130
|
+
with_connection { |c| c.quote_column_name(value) }
|
133
131
|
end
|
134
132
|
|
135
133
|
def unquote(part)
|
@@ -150,7 +148,7 @@ module PgHero
|
|
150
148
|
end
|
151
149
|
|
152
150
|
def table_exists?(table)
|
153
|
-
|
151
|
+
with_connection(stats: true) { |c| c.table_exists?(table) }
|
154
152
|
end
|
155
153
|
end
|
156
154
|
end
|
@@ -79,7 +79,9 @@ module PgHero
|
|
79
79
|
suggested_indexes.each do |index|
|
80
80
|
p index
|
81
81
|
if create
|
82
|
-
|
82
|
+
with_connection do |connection|
|
83
|
+
connection.execute("CREATE INDEX CONCURRENTLY ON #{quote_table_name(index[:table])} (#{index[:columns].map { |c| quote_column_name(c) }.join(",")})")
|
84
|
+
end
|
83
85
|
end
|
84
86
|
end
|
85
87
|
end
|
data/lib/pghero/version.rb
CHANGED
data/lib/pghero.rb
CHANGED
@@ -64,7 +64,7 @@ module PgHero
|
|
64
64
|
:query_stats_available?, :query_stats_enabled?, :query_stats_extension_enabled?, :query_stats_readable?,
|
65
65
|
:rds_stats, :read_iops_stats, :aws_region, :relation_sizes, :replica?, :replication_lag, :replication_lag_stats,
|
66
66
|
:reset_query_stats, :reset_stats, :running_queries, :aws_secret_access_key, :sequence_danger, :sequences, :settings,
|
67
|
-
:slow_queries, :space_growth, :ssl_used?, :
|
67
|
+
:slow_queries, :space_growth, :ssl_used?, :suggested_indexes, :suggested_indexes_by_query,
|
68
68
|
:suggested_indexes_enabled?, :system_stats_enabled?, :table_caching, :table_hit_rate, :table_stats,
|
69
69
|
:total_connections, :transaction_id_danger, :unused_indexes, :unused_tables, :write_iops_stats
|
70
70
|
|
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: 3.6.
|
4
|
+
version: 3.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kane
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -124,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
124
|
- !ruby/object:Gem::Version
|
125
125
|
version: '0'
|
126
126
|
requirements: []
|
127
|
-
rubygems_version: 3.5.
|
127
|
+
rubygems_version: 3.5.16
|
128
128
|
signing_key:
|
129
129
|
specification_version: 4
|
130
130
|
summary: A performance dashboard for Postgres
|