ruby-pg-extras 3.0.6 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/ruby-pg-extras/diagnose_data.rb +12 -14
- data/lib/ruby-pg-extras/diagnose_print.rb +7 -8
- data/lib/ruby-pg-extras/version.rb +1 -1
- data/lib/ruby-pg-extras.rb +2 -0
- data/spec/diagnose_print_spec.rb +9 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b09fa8f29c8e1b0438acf8834d8d51e4ab76b2b8c4c7475e7ac82902d9bc29d
|
4
|
+
data.tar.gz: 5a18583d3576f515ea05e0a5d74180c11d811a44d5ecca9d5bad001540f28a98
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a24a0a49e083f081d0d023f4f1b05d3fa867ef5b362f99eb6bc3c711616b857c5f434e5c23ffcc2ba42a0890f562f553694cb45434fa5484402569a827fe1fa
|
7
|
+
data.tar.gz: c50dd6d08c4e470a53257af9a7092271a6abeaab308579dc579efcd7df39e9b42031cc01f3d627225fcc73a26bb5c3253a6fe2c94ccc19812fc9671d88936a9b
|
@@ -18,14 +18,14 @@ module RubyPGExtras
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def call
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
21
|
+
[
|
22
|
+
:table_cache_hit,
|
23
|
+
:index_cache_hit,
|
24
|
+
:unused_indexes,
|
25
|
+
:null_indexes,
|
26
|
+
:bloat,
|
27
|
+
:duplicate_indexes
|
28
|
+
].yield_self do |checks|
|
29
29
|
extensions_data = query_module.extensions(in_format: :hash)
|
30
30
|
pg_stats_enabled = extensions_data.find do |el|
|
31
31
|
el.fetch("name") == "pg_stat_statements"
|
@@ -36,18 +36,16 @@ module RubyPGExtras
|
|
36
36
|
end.fetch("installed_version", false)
|
37
37
|
|
38
38
|
if pg_stats_enabled
|
39
|
-
checks.
|
40
|
-
outliers: outliers
|
41
|
-
})
|
39
|
+
checks = checks.concat([:outliers])
|
42
40
|
end
|
43
41
|
|
44
42
|
if ssl_info_enabled
|
45
|
-
checks.
|
46
|
-
ssl_used: ssl_used
|
47
|
-
})
|
43
|
+
checks = checks.concat([:ssl_used])
|
48
44
|
end
|
49
45
|
|
50
46
|
checks
|
47
|
+
end.map do |check|
|
48
|
+
send(check).merge(check_name: check)
|
51
49
|
end
|
52
50
|
end
|
53
51
|
|
@@ -9,17 +9,16 @@ module RubyPGExtras
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def call(data)
|
12
|
-
rows = data.sort do |
|
13
|
-
|
12
|
+
rows = data.sort do |el|
|
13
|
+
p el
|
14
|
+
el.fetch(:ok) ? 1 : -1
|
14
15
|
end.map do |el|
|
15
|
-
|
16
|
-
|
17
|
-
symbol = val.fetch(:ok) ? "√" : "x"
|
18
|
-
color = val.fetch(:ok) ? :green : :red
|
16
|
+
symbol = el.fetch(:ok) ? "√" : "x"
|
17
|
+
color = el.fetch(:ok) ? :green : :red
|
19
18
|
|
20
19
|
[
|
21
|
-
colorize("[#{symbol}] - #{
|
22
|
-
colorize(
|
20
|
+
colorize("[#{symbol}] - #{el.fetch(:check_name)}", color),
|
21
|
+
colorize(el.fetch(:message), color)
|
23
22
|
]
|
24
23
|
end
|
25
24
|
|
data/lib/ruby-pg-extras.rb
CHANGED
data/spec/diagnose_print_spec.rb
CHANGED
@@ -8,20 +8,23 @@ describe RubyPGExtras::DiagnosePrint do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
let(:data) do
|
11
|
-
|
12
|
-
|
11
|
+
[
|
12
|
+
{
|
13
|
+
:check_name => :table_cache_hit,
|
13
14
|
:ok => false,
|
14
15
|
:message => "Table hit ratio too low: 0.906977."
|
15
|
-
|
16
|
-
|
16
|
+
},
|
17
|
+
{
|
18
|
+
:check_name => :index_cache_hit,
|
17
19
|
:ok => false,
|
18
20
|
:message => "Index hit ratio is too low: 0.818182."
|
19
21
|
},
|
20
|
-
|
22
|
+
{
|
23
|
+
:check_name => :ssl_used,
|
21
24
|
:ok => true,
|
22
25
|
:message => "Database client is using a secure SSL connection."
|
23
26
|
}
|
24
|
-
|
27
|
+
]
|
25
28
|
end
|
26
29
|
|
27
30
|
describe "call" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-pg-extras
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pawurb
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-10-
|
11
|
+
date: 2021-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pg
|