postgres-vacuum-monitor 0.9.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/.travis.yml +3 -2
- data/CHANGELOG.md +4 -1
- data/lib/postgres/vacuum/jobs/monitor_job.rb +16 -0
- data/lib/postgres/vacuum/monitor/query.rb +22 -0
- data/lib/postgres/vacuum/monitor/version.rb +1 -1
- data/postgres-vacuum-monitor.gemspec +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ab4f56ed45e6863e0d69c3c2657fed7183f1fcf1d077bfc1baa00fa1022c794
|
4
|
+
data.tar.gz: bf88a041ad9ac3ea4f28f5ad8b02b5d1831020a578dc5acfafb72eae5e8690c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c2faf27d466c5a623cd177fa76e372b6caafb708f31ff12c6398b77eeff54230abdb5c7fa15ecdae740a882659b8a1bd77138f3529efc4a9562237954f98277a
|
7
|
+
data.tar.gz: 4e5cc971b6c0a841c868f90b754d46304117cf739f588ed68fea454628e1d621ac0412234012a46d2518761c0575be89bd1ad4045726bc5a74a38ca031303de2
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,8 @@ module Postgres
|
|
6
6
|
AUTOVACUUM_LAGGING_EVENT = 'AutoVacuumLagging'.freeze
|
7
7
|
LONG_TRANSACTIONS = 'LongTransactions'.freeze
|
8
8
|
BLOCKED_QUERIES = 'BlockedQueries'.freeze
|
9
|
+
CONNECTION_STATE = 'ConnectionState'.freeze
|
10
|
+
CONNECTION_IDLE_TIME = 'ConnectionIdleTime'.freeze
|
9
11
|
|
10
12
|
def perform(*)
|
11
13
|
with_each_db_name_and_connection do |name, connection|
|
@@ -47,6 +49,20 @@ module Postgres
|
|
47
49
|
current_statement_in_blocking_process: row['current_statement_in_blocking_process']
|
48
50
|
)
|
49
51
|
end
|
52
|
+
|
53
|
+
connection.execute(Postgres::Vacuum::Monitor::Query.connection_state).each do |row|
|
54
|
+
reporter_class.report_event(CONNECTION_STATE, database_name: name, state: row['state'], connection_count: row['connection_count'])
|
55
|
+
end
|
56
|
+
|
57
|
+
connection.execute(Postgres::Vacuum::Monitor::Query.connection_idle_time).each do |row|
|
58
|
+
reporter_class.report_event(
|
59
|
+
CONNECTION_IDLE_TIME,
|
60
|
+
database_name: name,
|
61
|
+
max: row['max'],
|
62
|
+
median: row['median'],
|
63
|
+
percentile_90: row['percentile_90']
|
64
|
+
)
|
65
|
+
end
|
50
66
|
end
|
51
67
|
|
52
68
|
true
|
@@ -97,6 +97,28 @@ module Postgres
|
|
97
97
|
WHERE NOT blocked_locks.GRANTED;
|
98
98
|
SQL
|
99
99
|
end
|
100
|
+
|
101
|
+
def connection_state
|
102
|
+
<<-SQL
|
103
|
+
SELECT
|
104
|
+
state, count(*) as connection_count
|
105
|
+
FROM pg_stat_activity
|
106
|
+
GROUP BY state
|
107
|
+
ORDER BY count DESC;
|
108
|
+
SQL
|
109
|
+
end
|
110
|
+
|
111
|
+
def connection_idle_time
|
112
|
+
<<-SQL
|
113
|
+
SELECT
|
114
|
+
max(EXTRACT(EPOCH FROM (CURRENT_TIMESTAMP - state_change))) as max,
|
115
|
+
percentile_cont(0.5) within GROUP (ORDER BY EXTRACT(EPOCH FROM (CURRENT_TIMESTAMP - state_change)) DESC) AS median,
|
116
|
+
percentile_cont(0.9) within GROUP (ORDER BY EXTRACT(EPOCH FROM (CURRENT_TIMESTAMP - state_change)) DESC) AS percentile_90
|
117
|
+
FROM pg_stat_activity
|
118
|
+
WHERE state = 'idle'
|
119
|
+
LIMIT 1000;
|
120
|
+
SQL
|
121
|
+
end
|
100
122
|
end
|
101
123
|
end
|
102
124
|
end
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
|
25
25
|
spec.add_development_dependency 'appraisal'
|
26
26
|
spec.add_development_dependency 'bundler'
|
27
|
-
spec.add_development_dependency '
|
27
|
+
spec.add_development_dependency 'coveralls_reborn', '>= 0.18.0'
|
28
28
|
spec.add_development_dependency 'database_cleaner'
|
29
29
|
spec.add_development_dependency 'rake', '~> 10.0'
|
30
30
|
spec.add_development_dependency 'rspec', '~> 3.2'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: postgres-vacuum-monitor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fernando Garces
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: appraisal
|
@@ -39,19 +39,19 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: coveralls_reborn
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 0.18.0
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 0.18.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: database_cleaner
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -180,7 +180,7 @@ files:
|
|
180
180
|
homepage: https://github.com/salsify/postgres-vacuum-monitor
|
181
181
|
licenses: []
|
182
182
|
metadata: {}
|
183
|
-
post_install_message:
|
183
|
+
post_install_message:
|
184
184
|
rdoc_options: []
|
185
185
|
require_paths:
|
186
186
|
- lib
|
@@ -195,8 +195,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
195
195
|
- !ruby/object:Gem::Version
|
196
196
|
version: '0'
|
197
197
|
requirements: []
|
198
|
-
rubygems_version: 3.
|
199
|
-
signing_key:
|
198
|
+
rubygems_version: 3.1.2
|
199
|
+
signing_key:
|
200
200
|
specification_version: 4
|
201
201
|
summary: Simple stats collector for postgres auto vacuumer.
|
202
202
|
test_files: []
|