heartcheck-redis 1.0.2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/heartcheck/checks/redis.rb +26 -3
- data/lib/heartcheck/redis.rb +1 -0
- data/lib/heartcheck/redis/version.rb +1 -1
- metadata +34 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: dbf2eded13051605c6d81ca3da9463d5065fa8a341aad44d6566c3687db9b963
|
4
|
+
data.tar.gz: 8a2b8cddd57fec14cfa3900f1dc2593e8705df673cc40cf2f5626d40b773ede7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 548023f425d962e60adbbf726baa9096ed2de64ac0a11a292a0b862a550d31580c0591ed64b57d99bbf4a74c8c0cd630c736b438de07451ad35dd634197c5f23
|
7
|
+
data.tar.gz: 4307a241ec7b31cb335300a65e73ade04db94c6e4fcf01c1058bd5bb8a1ed35a3ef8cbd6959d2bb3aa4cedb41b65a6d134545547d5ce86acf73657637cd40124
|
@@ -16,6 +16,20 @@ module Heartcheck
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
+
# list services uri info
|
20
|
+
#
|
21
|
+
# @return [Array]
|
22
|
+
def uri_info
|
23
|
+
services.map do |s|
|
24
|
+
opts = s[:connection].connection
|
25
|
+
{
|
26
|
+
host: opts[:host],
|
27
|
+
port: opts[:port],
|
28
|
+
scheme: 'redis'.freeze
|
29
|
+
}
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
19
33
|
private
|
20
34
|
|
21
35
|
# test if can write on redis
|
@@ -24,7 +38,7 @@ module Heartcheck
|
|
24
38
|
#
|
25
39
|
# @return [Bollean]
|
26
40
|
def set?(con)
|
27
|
-
con.set(
|
41
|
+
con.set(unique_check_key, 'heartcheck') == 'OK'
|
28
42
|
end
|
29
43
|
|
30
44
|
# test if can read on redis
|
@@ -33,7 +47,7 @@ module Heartcheck
|
|
33
47
|
#
|
34
48
|
# @return [Bollean]
|
35
49
|
def get?(con)
|
36
|
-
con.get(
|
50
|
+
con.get(unique_check_key) == 'heartcheck'
|
37
51
|
end
|
38
52
|
|
39
53
|
# test if can delete on redis
|
@@ -42,7 +56,7 @@ module Heartcheck
|
|
42
56
|
#
|
43
57
|
# @return [Bollean]
|
44
58
|
def del?(con)
|
45
|
-
con.del(
|
59
|
+
con.del(unique_check_key) == 1
|
46
60
|
end
|
47
61
|
|
48
62
|
# customize the error message
|
@@ -55,6 +69,15 @@ module Heartcheck
|
|
55
69
|
def custom_error(name, key_error)
|
56
70
|
@errors << "#{name} fails to #{key_error}"
|
57
71
|
end
|
72
|
+
|
73
|
+
# generate an unique redis key
|
74
|
+
# It's necessary to run concurrent application instances/checks using a
|
75
|
+
# shared redis
|
76
|
+
#
|
77
|
+
# @return [String]
|
78
|
+
def unique_check_key
|
79
|
+
@unique_check_key ||= SecureRandom.hex
|
80
|
+
end
|
58
81
|
end
|
59
82
|
end
|
60
83
|
end
|
data/lib/heartcheck/redis.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: heartcheck-redis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Locaweb
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-telnet
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: heartcheck
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: '2.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: '2.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: redis
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -47,7 +47,7 @@ dependencies:
|
|
47
47
|
version: 3.2.0
|
48
48
|
- - "<"
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version:
|
50
|
+
version: '5'
|
51
51
|
type: :runtime
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -57,14 +57,14 @@ dependencies:
|
|
57
57
|
version: 3.2.0
|
58
58
|
- - "<"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version:
|
60
|
+
version: '5'
|
61
61
|
- !ruby/object:Gem::Dependency
|
62
62
|
name: pry-nav
|
63
63
|
requirement: !ruby/object:Gem::Requirement
|
64
64
|
requirements:
|
65
65
|
- - "~>"
|
66
66
|
- !ruby/object:Gem::Version
|
67
|
-
version: 0.2
|
67
|
+
version: '0.2'
|
68
68
|
- - ">="
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: 0.2.4
|
@@ -74,77 +74,73 @@ dependencies:
|
|
74
74
|
requirements:
|
75
75
|
- - "~>"
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: 0.2
|
77
|
+
version: '0.2'
|
78
78
|
- - ">="
|
79
79
|
- !ruby/object:Gem::Version
|
80
80
|
version: 0.2.4
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
|
-
name:
|
82
|
+
name: rake
|
83
83
|
requirement: !ruby/object:Gem::Requirement
|
84
84
|
requirements:
|
85
85
|
- - "~>"
|
86
86
|
- !ruby/object:Gem::Version
|
87
|
-
version:
|
88
|
-
- - ">="
|
89
|
-
- !ruby/object:Gem::Version
|
90
|
-
version: 3.1.0
|
87
|
+
version: '10.0'
|
91
88
|
type: :development
|
92
89
|
prerelease: false
|
93
90
|
version_requirements: !ruby/object:Gem::Requirement
|
94
91
|
requirements:
|
95
92
|
- - "~>"
|
96
93
|
- !ruby/object:Gem::Version
|
97
|
-
version:
|
98
|
-
|
94
|
+
version: '10.0'
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
name: rspec
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - "~>"
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '3.1'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - "~>"
|
99
107
|
- !ruby/object:Gem::Version
|
100
|
-
version: 3.1
|
108
|
+
version: '3.1'
|
101
109
|
- !ruby/object:Gem::Dependency
|
102
110
|
name: rubocop
|
103
111
|
requirement: !ruby/object:Gem::Requirement
|
104
112
|
requirements:
|
105
113
|
- - "~>"
|
106
114
|
- !ruby/object:Gem::Version
|
107
|
-
version: 0.
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: 0.27.1
|
115
|
+
version: '0.52'
|
111
116
|
type: :development
|
112
117
|
prerelease: false
|
113
118
|
version_requirements: !ruby/object:Gem::Requirement
|
114
119
|
requirements:
|
115
120
|
- - "~>"
|
116
121
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0.
|
118
|
-
- - ">="
|
119
|
-
- !ruby/object:Gem::Version
|
120
|
-
version: 0.27.1
|
122
|
+
version: '0.52'
|
121
123
|
- !ruby/object:Gem::Dependency
|
122
124
|
name: yard
|
123
125
|
requirement: !ruby/object:Gem::Requirement
|
124
126
|
requirements:
|
125
127
|
- - "~>"
|
126
128
|
- !ruby/object:Gem::Version
|
127
|
-
version: 0.
|
128
|
-
- - ">="
|
129
|
-
- !ruby/object:Gem::Version
|
130
|
-
version: 0.8.7
|
129
|
+
version: '0.9'
|
131
130
|
type: :development
|
132
131
|
prerelease: false
|
133
132
|
version_requirements: !ruby/object:Gem::Requirement
|
134
133
|
requirements:
|
135
134
|
- - "~>"
|
136
135
|
- !ruby/object:Gem::Version
|
137
|
-
version: 0.
|
138
|
-
- - ">="
|
139
|
-
- !ruby/object:Gem::Version
|
140
|
-
version: 0.8.7
|
136
|
+
version: '0.9'
|
141
137
|
- !ruby/object:Gem::Dependency
|
142
138
|
name: redcarpet
|
143
139
|
requirement: !ruby/object:Gem::Requirement
|
144
140
|
requirements:
|
145
141
|
- - "~>"
|
146
142
|
- !ruby/object:Gem::Version
|
147
|
-
version: 3.2
|
143
|
+
version: '3.2'
|
148
144
|
- - ">="
|
149
145
|
- !ruby/object:Gem::Version
|
150
146
|
version: 3.2.2
|
@@ -154,7 +150,7 @@ dependencies:
|
|
154
150
|
requirements:
|
155
151
|
- - "~>"
|
156
152
|
- !ruby/object:Gem::Version
|
157
|
-
version: 3.2
|
153
|
+
version: '3.2'
|
158
154
|
- - ">="
|
159
155
|
- !ruby/object:Gem::Version
|
160
156
|
version: 3.2.2
|
@@ -180,15 +176,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
180
176
|
requirements:
|
181
177
|
- - ">="
|
182
178
|
- !ruby/object:Gem::Version
|
183
|
-
version: '
|
179
|
+
version: '2.3'
|
184
180
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
185
181
|
requirements:
|
186
182
|
- - ">="
|
187
183
|
- !ruby/object:Gem::Version
|
188
184
|
version: '0'
|
189
185
|
requirements: []
|
190
|
-
|
191
|
-
rubygems_version: 2.6.11
|
186
|
+
rubygems_version: 3.0.3
|
192
187
|
signing_key:
|
193
188
|
specification_version: 4
|
194
189
|
summary: A redis checker.
|