pg-locks-monitor 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -5
- data/lib/pg-locks-monitor.rb +6 -18
- data/lib/pg_locks_monitor/version.rb +1 -1
- 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: 3c123754d01da5acc5a517511066987515ec3167c0063a59c67b272ba0fd39ac
|
4
|
+
data.tar.gz: c85d88f96b9593ebb04a849e6cc79958a3040eb119980d17585cb69fdea1733b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1f98b1c258f99a3943e178d81f370b664be38b1841edb302364f0796c06302b2487819bb09d66d3c6dd5161999af21ecb1e4e769f7ff0a3be287620774811f3
|
7
|
+
data.tar.gz: 340ae2e8bf451994e1f960a5c8196bd1739790b2e7634ded97c1990fb12d0c121078a301e8fcb9408a7bf63ce8f096730d8f038817fd18eb29a2114c7f6eeca0
|
data/README.md
CHANGED
data/lib/pg-locks-monitor.rb
CHANGED
@@ -13,7 +13,11 @@ module PgLocksMonitor
|
|
13
13
|
if (age = lock.fetch("age"))
|
14
14
|
(ActiveSupport::Duration.parse(age).to_f * 1000) > configuration.locks_min_duration_ms
|
15
15
|
end
|
16
|
-
end.select
|
16
|
+
end.select do |lock|
|
17
|
+
# meta locks with duplicate data
|
18
|
+
lock.fetch("locktype") != "virtualxid"
|
19
|
+
end
|
20
|
+
.select(&configuration.locks_filter_proc)
|
17
21
|
.first(configuration.locks_limit)
|
18
22
|
|
19
23
|
if locks.count > 0 && configuration.monitor_locks
|
@@ -22,7 +26,7 @@ module PgLocksMonitor
|
|
22
26
|
|
23
27
|
blocking = RailsPgExtras.blocking(in_format: :hash).select do |block|
|
24
28
|
if (age = block.fetch("blocking_duration"))
|
25
|
-
(ActiveSupport::Duration.parse(age).to_f * 1000) > configuration.
|
29
|
+
(ActiveSupport::Duration.parse(age).to_f * 1000) > configuration.blocking_min_duration_ms
|
26
30
|
end
|
27
31
|
end.select(&configuration.blocking_filter_proc)
|
28
32
|
.first(configuration.locks_limit)
|
@@ -44,22 +48,6 @@ module PgLocksMonitor
|
|
44
48
|
def self.configure
|
45
49
|
yield(configuration)
|
46
50
|
end
|
47
|
-
|
48
|
-
class DurationHelper
|
49
|
-
require "date"
|
50
|
-
|
51
|
-
def self.parse_to_ms(duration_str)
|
52
|
-
time = DateTime.strptime(duration_str, "%H:%M:%S.%N")
|
53
|
-
hours = time.hour
|
54
|
-
minutes = time.minute
|
55
|
-
seconds = time.second
|
56
|
-
nanoseconds = time.second_fraction * (10 ** 9)
|
57
|
-
|
58
|
-
total_ms = (hours * 3600 * 1000) + (minutes * 60 * 1000) + (seconds * 1000) + (nanoseconds / 1_000_000).to_i
|
59
|
-
|
60
|
-
total_ms
|
61
|
-
end
|
62
|
-
end
|
63
51
|
end
|
64
52
|
|
65
53
|
require "pg_locks_monitor/default_notifier"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pg-locks-monitor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pawurb
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-10-
|
11
|
+
date: 2024-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails-pg-extras
|