heartcheck-sidekiq 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 15c0a1249d539e89dfa433522c1f0b6dc586bb3d
4
+ data.tar.gz: 9cac2d87e28c7d69ce4ced754047e44effa65a2a
5
+ SHA512:
6
+ metadata.gz: d63748e41ae537e3dedc7dd2936f4a6c2126c2ceac11b25b5eae296446a3507de3a65d42260e8a7dbb73fc0beadb37cbdc4e1819f009225b79a1e8c01d8aa192
7
+ data.tar.gz: 0999eab11344c8f8357bc20629976098a914292c2a0566b58effde5bddb53cc66980bf9f67821c6ebac90f3c0008958880a92e37180b442da2124c5cf569dd41
@@ -0,0 +1,61 @@
1
+ module Heartcheck
2
+ module Checks
3
+ # Check for a sidekiq service
4
+ # Base is set in heartcheck gem
5
+ class Sidekiq < Base
6
+ # validate service connection
7
+ #
8
+ # @retun [void]
9
+ def validate
10
+ ::Sidekiq.redis do |connection|
11
+ append_error(:set) unless set?(connection)
12
+ append_error(:get) unless get?(connection)
13
+ append_error(:delete) unless del?(connection)
14
+ end
15
+ rescue Redis::BaseError
16
+ append_error('connect to redis')
17
+ rescue => e
18
+ @errors << "Sidekiq error: #{e.message}"
19
+ end
20
+
21
+ private
22
+
23
+ # test if can write on redis
24
+ #
25
+ # @param con [Redis] an instance of redis
26
+ #
27
+ # @return [Bollean]
28
+ def set?(con)
29
+ con.set('check_test', 'heartcheck') == 'OK'
30
+ end
31
+
32
+ # test if can read on redis
33
+ #
34
+ # @param con [Redis] an instance of redis
35
+ #
36
+ # @return [Bollean]
37
+ def get?(con)
38
+ con.get('check_test') == 'heartcheck'
39
+ end
40
+
41
+ # test if can delete on redis
42
+ #
43
+ # @param con [Redis] an instance of redis
44
+ #
45
+ # @return [Bollean]
46
+ def del?(con)
47
+ con.del('check_test') == 1
48
+ end
49
+
50
+ # customize the error message
51
+ # It's called in Heartcheck::Checks::Base#append_error
52
+ #
53
+ # @param key_error [Symbol] name of action
54
+ #
55
+ # @return [void]
56
+ def custom_error(key_error)
57
+ @errors << "Sidekiq fails to #{key_error}"
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,3 @@
1
+ require 'sidekiq'
2
+ require 'heartcheck'
3
+ require 'heartcheck/checks/sidekiq'
@@ -0,0 +1,7 @@
1
+ # from hearcheck gem
2
+ module Heartcheck
3
+ # gem version
4
+ module Sidekiq
5
+ VERSION = '0.0.1'
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,181 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: heartcheck-sidekiq
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Locaweb
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2015-05-12 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: heartcheck
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 1.0.0
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 1.0.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: 1.0.0
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 1.0.0
33
+ - !ruby/object:Gem::Dependency
34
+ name: sidekiq
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: 2.0.0
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: 2.0.0
47
+ - !ruby/object:Gem::Dependency
48
+ name: pry-nav
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: 0.2.0
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: 0.2.4
57
+ type: :development
58
+ prerelease: false
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - "~>"
62
+ - !ruby/object:Gem::Version
63
+ version: 0.2.0
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: 0.2.4
67
+ - !ruby/object:Gem::Dependency
68
+ name: rspec
69
+ requirement: !ruby/object:Gem::Requirement
70
+ requirements:
71
+ - - "~>"
72
+ - !ruby/object:Gem::Version
73
+ version: 3.1.0
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: 3.1.0
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - "~>"
82
+ - !ruby/object:Gem::Version
83
+ version: 3.1.0
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: 3.1.0
87
+ - !ruby/object:Gem::Dependency
88
+ name: rubocop
89
+ requirement: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - "~>"
92
+ - !ruby/object:Gem::Version
93
+ version: 0.27.0
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: 0.27.1
97
+ type: :development
98
+ prerelease: false
99
+ version_requirements: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 0.27.0
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: 0.27.1
107
+ - !ruby/object:Gem::Dependency
108
+ name: yard
109
+ requirement: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - "~>"
112
+ - !ruby/object:Gem::Version
113
+ version: 0.8.0
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: 0.8.7
117
+ type: :development
118
+ prerelease: false
119
+ version_requirements: !ruby/object:Gem::Requirement
120
+ requirements:
121
+ - - "~>"
122
+ - !ruby/object:Gem::Version
123
+ version: 0.8.0
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: 0.8.7
127
+ - !ruby/object:Gem::Dependency
128
+ name: redcarpet
129
+ requirement: !ruby/object:Gem::Requirement
130
+ requirements:
131
+ - - "~>"
132
+ - !ruby/object:Gem::Version
133
+ version: 3.2.0
134
+ - - ">="
135
+ - !ruby/object:Gem::Version
136
+ version: 3.2.2
137
+ type: :development
138
+ prerelease: false
139
+ version_requirements: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - "~>"
142
+ - !ruby/object:Gem::Version
143
+ version: 3.2.0
144
+ - - ">="
145
+ - !ruby/object:Gem::Version
146
+ version: 3.2.2
147
+ description: Plugin to check sidekiq connection in heartcheck.
148
+ email:
149
+ - desenvolvedores@locaweb.com.br
150
+ executables: []
151
+ extensions: []
152
+ extra_rdoc_files: []
153
+ files:
154
+ - lib/heartcheck/checks/sidekiq.rb
155
+ - lib/heartcheck/sidekiq.rb
156
+ - lib/heartcheck/sidekiq/version.rb
157
+ homepage: http://developer.locaweb.com.br
158
+ licenses:
159
+ - MIT
160
+ metadata: {}
161
+ post_install_message:
162
+ rdoc_options: []
163
+ require_paths:
164
+ - lib
165
+ required_ruby_version: !ruby/object:Gem::Requirement
166
+ requirements:
167
+ - - ">="
168
+ - !ruby/object:Gem::Version
169
+ version: '0'
170
+ required_rubygems_version: !ruby/object:Gem::Requirement
171
+ requirements:
172
+ - - ">="
173
+ - !ruby/object:Gem::Version
174
+ version: '0'
175
+ requirements: []
176
+ rubyforge_project:
177
+ rubygems_version: 2.4.6
178
+ signing_key:
179
+ specification_version: 4
180
+ summary: A sidekiq checker
181
+ test_files: []