postgres-vacuum-monitor 0.14.1 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +2 -6
- data/.github/CODEOWNERS +1 -1
- data/Appraisals +6 -6
- data/CHANGELOG.md +8 -0
- data/README.md +5 -1
- data/gemfiles/activerecord_6_1.gemfile +1 -1
- data/gemfiles/activerecord_7_0.gemfile +1 -1
- data/gemfiles/{activerecord_6_0.gemfile → activerecord_7_1.gemfile} +1 -1
- data/lib/postgres/vacuum/configuration.rb +9 -1
- data/lib/postgres/vacuum/jobs/monitor_job.rb +9 -5
- data/lib/postgres/vacuum/monitor/version.rb +1 -1
- data/lib/postgres/vacuum/monitor.rb +0 -1
- data/postgres-vacuum-monitor.gemspec +1 -1
- metadata +5 -6
- data/lib/postgres/vacuum/compatibility.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d9e8b90692a2b1bbadc40202497aae4af9a3e088b8c5a47869396ba5d14e796
|
4
|
+
data.tar.gz: 7db2e649f6c350a613e6b765f0cf9fe4f10cae9a4b0aa05f47a585519a029ad3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7668c76a3666dfa35a70c26a923b2a9aebd1f0d1d96c3f4f5fe868dcba9c6f2ec4e15edcf1dbba07b17ab460b04d898c3468709e0dfd54532d6b503ca02f63f7
|
7
|
+
data.tar.gz: 284047bdc67471afda8abc017e377d3536de6e1593bfcc9993bc8ff16d5be562194b4f552f36ef150259c51b34571fcfc5b6ada56767da6fb2469d48c50aeca0
|
data/.circleci/config.yml
CHANGED
@@ -38,12 +38,10 @@ jobs:
|
|
38
38
|
type: string
|
39
39
|
ruby_version:
|
40
40
|
type: string
|
41
|
-
postgres_version:
|
42
|
-
type: string
|
43
41
|
docker:
|
44
42
|
- image: $SALSIFY_ECR_REPO/ruby_ci:<< parameters.ruby_version >>
|
45
43
|
<<: *aws-auth
|
46
|
-
- image: cimg/postgres
|
44
|
+
- image: cimg/postgres:14.7
|
47
45
|
environment:
|
48
46
|
POSTGRES_USER: "circleci"
|
49
47
|
POSTGRES_DB: "circle_test"
|
@@ -98,10 +96,8 @@ workflows:
|
|
98
96
|
gemfile:
|
99
97
|
- "gemfiles/activerecord_6_1.gemfile"
|
100
98
|
- "gemfiles/activerecord_7_0.gemfile"
|
99
|
+
- "gemfiles/activerecord_7_1.gemfile"
|
101
100
|
ruby_version:
|
102
101
|
- "3.0.6"
|
103
102
|
- "3.1.4"
|
104
103
|
- "3.2.2"
|
105
|
-
postgres_version:
|
106
|
-
- "12.9"
|
107
|
-
- "14.7"
|
data/.github/CODEOWNERS
CHANGED
@@ -1 +1 @@
|
|
1
|
-
* @
|
1
|
+
* @salsify/pim-core-backend
|
data/Appraisals
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
appraise 'activerecord_6_0' do
|
4
|
-
gem 'activerecord', '~> 6.0.0'
|
5
|
-
end
|
6
|
-
|
7
3
|
appraise 'activerecord_6_1' do
|
8
|
-
gem 'activerecord', '~> 6.1.
|
4
|
+
gem 'activerecord', '~> 6.1.7.6'
|
9
5
|
end
|
10
6
|
|
11
7
|
appraise 'activerecord_7_0' do
|
12
|
-
gem 'activerecord', '~> 7.0.
|
8
|
+
gem 'activerecord', '~> 7.0.8'
|
9
|
+
end
|
10
|
+
|
11
|
+
appraise 'activerecord_7_1' do
|
12
|
+
gem 'activerecord', '~> 7.1.1'
|
13
13
|
end
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# postgres-vacuum-monitor
|
2
2
|
|
3
|
+
## v0.16.0
|
4
|
+
- Add `max_attempts` and `max_run_time` to `Postgres::Vacuum::Jobs::MonitorJob` to avoid backing up the queue. The
|
5
|
+
defaults are 1 attempt and 10 seconds, but they can be configured with `monitor_max_attempts` and
|
6
|
+
`monitor_max_run_time_seconds`, respectively.
|
7
|
+
|
8
|
+
## v0.15.0
|
9
|
+
- Add support for Rails 7.1
|
10
|
+
|
3
11
|
## v0.14.1
|
4
12
|
- Requires activerecord >= 6.1
|
5
13
|
|
data/README.md
CHANGED
@@ -34,7 +34,11 @@ The job itself needs a class to report the information and can be configured by
|
|
34
34
|
Postgres::Vacuum::Monitor.configure do |config|
|
35
35
|
config.monitor_reporter_class_name = 'MetricsReporter'
|
36
36
|
# Optionally change the default threshold of 5 minutes for reporting long running transactions
|
37
|
-
config.long_running_transaction_threshold_seconds = 10 * 60
|
37
|
+
config.long_running_transaction_threshold_seconds = 10 * 60
|
38
|
+
# Optionally change `max_attempts` of the monitor job (default 1)
|
39
|
+
config.monitor_max_attempts = 3
|
40
|
+
# Optionally change `max_run_time` of the monitor job (default 10 seconds)
|
41
|
+
config.monitor_max_run_time_seconds = 5
|
38
42
|
end
|
39
43
|
```
|
40
44
|
|
@@ -4,11 +4,19 @@ module Postgres
|
|
4
4
|
module Vacuum
|
5
5
|
class Configuration
|
6
6
|
DEFAULT_LONG_RUNNING_TRANSACTION_THRESHOLD_SECONDS = 5 * 60
|
7
|
-
|
7
|
+
DEFAULT_MONITOR_MAX_RUN_TIME_SECONDS = 10
|
8
|
+
DEFAULT_MONITOR_MAX_ATTEMPTS = 1
|
9
|
+
|
10
|
+
attr_accessor :monitor_reporter_class_name,
|
11
|
+
:long_running_transaction_threshold_seconds,
|
12
|
+
:monitor_max_run_time_seconds,
|
13
|
+
:monitor_max_attempts
|
8
14
|
|
9
15
|
def initialize
|
10
16
|
self.monitor_reporter_class_name = nil
|
11
17
|
self.long_running_transaction_threshold_seconds = DEFAULT_LONG_RUNNING_TRANSACTION_THRESHOLD_SECONDS
|
18
|
+
self.monitor_max_run_time_seconds = DEFAULT_MONITOR_MAX_RUN_TIME_SECONDS
|
19
|
+
self.monitor_max_attempts = DEFAULT_MONITOR_MAX_ATTEMPTS
|
12
20
|
end
|
13
21
|
end
|
14
22
|
end
|
@@ -11,6 +11,14 @@ module Postgres
|
|
11
11
|
CONNECTION_STATE = 'ConnectionState'
|
12
12
|
CONNECTION_IDLE_TIME = 'ConnectionIdleTime'
|
13
13
|
|
14
|
+
def max_run_time
|
15
|
+
Postgres::Vacuum::Monitor.configuration.monitor_max_run_time_seconds.seconds
|
16
|
+
end
|
17
|
+
|
18
|
+
def max_attempts
|
19
|
+
Postgres::Vacuum::Monitor.configuration.monitor_max_attempts
|
20
|
+
end
|
21
|
+
|
14
22
|
def perform(*)
|
15
23
|
with_each_db_name_and_connection do |name, connection|
|
16
24
|
connection.execute(Postgres::Vacuum::Monitor::Query.long_running_transactions).each do |row|
|
@@ -89,11 +97,7 @@ module Postgres
|
|
89
97
|
def with_each_db_name_and_connection
|
90
98
|
databases = Set.new
|
91
99
|
ActiveRecord::Base.connection_handler.connection_pools.map do |connection_pool|
|
92
|
-
db_name =
|
93
|
-
connection_pool.spec.config[:database]
|
94
|
-
else
|
95
|
-
connection_pool.db_config.configuration_hash[:database]
|
96
|
-
end
|
100
|
+
db_name = connection_pool.db_config.configuration_hash[:database]
|
97
101
|
|
98
102
|
# activerecord allocates a connection pool per call to establish_connection
|
99
103
|
# multiple pools might interact with the same database so we use the
|
@@ -40,6 +40,6 @@ Gem::Specification.new do |spec|
|
|
40
40
|
spec.add_development_dependency 'rspec_junit_formatter'
|
41
41
|
spec.add_development_dependency 'salsify_rubocop', '~> 1.42.1'
|
42
42
|
|
43
|
-
spec.add_dependency 'activerecord', '>= 6.1', '< 7.
|
43
|
+
spec.add_dependency 'activerecord', '>= 6.1', '< 7.2'
|
44
44
|
spec.add_dependency 'pg', '>= 0.18', '< 2.0'
|
45
45
|
end
|
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.16.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Fernando Garces
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: appraisal
|
@@ -131,7 +131,7 @@ dependencies:
|
|
131
131
|
version: '6.1'
|
132
132
|
- - "<"
|
133
133
|
- !ruby/object:Gem::Version
|
134
|
-
version: '7.
|
134
|
+
version: '7.2'
|
135
135
|
type: :runtime
|
136
136
|
prerelease: false
|
137
137
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -141,7 +141,7 @@ dependencies:
|
|
141
141
|
version: '6.1'
|
142
142
|
- - "<"
|
143
143
|
- !ruby/object:Gem::Version
|
144
|
-
version: '7.
|
144
|
+
version: '7.2'
|
145
145
|
- !ruby/object:Gem::Dependency
|
146
146
|
name: pg
|
147
147
|
requirement: !ruby/object:Gem::Requirement
|
@@ -184,10 +184,9 @@ files:
|
|
184
184
|
- Rakefile
|
185
185
|
- bin/console
|
186
186
|
- bin/setup
|
187
|
-
- gemfiles/activerecord_6_0.gemfile
|
188
187
|
- gemfiles/activerecord_6_1.gemfile
|
189
188
|
- gemfiles/activerecord_7_0.gemfile
|
190
|
-
-
|
189
|
+
- gemfiles/activerecord_7_1.gemfile
|
191
190
|
- lib/postgres/vacuum/configuration.rb
|
192
191
|
- lib/postgres/vacuum/jobs/monitor_job.rb
|
193
192
|
- lib/postgres/vacuum/monitor.rb
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Postgres
|
4
|
-
module Vacuum
|
5
|
-
class Compatibility
|
6
|
-
ACTIVE_RECORD_VERSION = ::Gem::Version.new(::ActiveRecord::VERSION::STRING).release
|
7
|
-
PRE_RAILS_6_1 = ACTIVE_RECORD_VERSION < ::Gem::Version.new('6.1.0')
|
8
|
-
|
9
|
-
def self.pre_rails_6_1?
|
10
|
-
PRE_RAILS_6_1
|
11
|
-
end
|
12
|
-
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|