status-page 0.1.3 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/status-page/configuration.rb +8 -2
- data/lib/status-page/services/base.rb +12 -14
- data/lib/status-page/services/redis.rb +15 -1
- data/lib/status-page/services/sidekiq.rb +1 -2
- data/lib/status-page/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52c384a41db820198ceabb23d287329bd7104c4c
|
4
|
+
data.tar.gz: 32ced89c5f80c3783fbb625c4bf5671c5be4b8b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ea6aa76924f33883ad37c37acd3c6228871f430f739dd7b2efad68c987965c1cec2d07989582cc3dcea6e6d1fb04700dacb7ae4a8e9f2114fc21c23decbc7ea
|
7
|
+
data.tar.gz: 0143b82d88d195c3aed4c61ebfc6a56e0549391290795e18f59374271a39009ccb4d8fa7aff9232b7875a350bc41c719906edecc539fdcef62c22d2c85b675e6
|
data/README.md
CHANGED
@@ -8,9 +8,15 @@ module StatusPage
|
|
8
8
|
@interval = 10
|
9
9
|
end
|
10
10
|
|
11
|
-
def use(service_name)
|
11
|
+
def use(service_name, opts = {})
|
12
12
|
require "status-page/services/#{service_name}"
|
13
|
-
|
13
|
+
klass = "StatusPage::Services::#{service_name.capitalize}".constantize
|
14
|
+
if klass.respond_to?(:configurable?) && klass.configurable?
|
15
|
+
opts.each_key do |key|
|
16
|
+
klass.config.send("#{key}=", opts[key])
|
17
|
+
end
|
18
|
+
end
|
19
|
+
add_service(klass)
|
14
20
|
end
|
15
21
|
|
16
22
|
def add_custom_service(custom_service_class)
|
@@ -2,24 +2,13 @@ module StatusPage
|
|
2
2
|
module Services
|
3
3
|
class Base
|
4
4
|
attr_reader :request
|
5
|
-
cattr_accessor :config
|
6
|
-
|
7
|
-
def self.service_name
|
8
|
-
@name ||= name.demodulize
|
9
|
-
end
|
10
|
-
|
11
|
-
def self.configure
|
12
|
-
return unless configurable?
|
13
|
-
|
14
|
-
self.config ||= config_class.new
|
15
|
-
|
16
|
-
yield self.config if block_given?
|
17
|
-
end
|
18
5
|
|
19
6
|
def initialize(request: nil)
|
20
7
|
@request = request
|
8
|
+
end
|
21
9
|
|
22
|
-
|
10
|
+
def self.service_name
|
11
|
+
@name ||= name.demodulize
|
23
12
|
end
|
24
13
|
|
25
14
|
# @abstract
|
@@ -27,6 +16,15 @@ module StatusPage
|
|
27
16
|
raise NotImplementedError
|
28
17
|
end
|
29
18
|
|
19
|
+
def self.config
|
20
|
+
return nil if !self.configurable?
|
21
|
+
@config ||= config_class.new
|
22
|
+
end
|
23
|
+
|
24
|
+
def config
|
25
|
+
self.class.config
|
26
|
+
end
|
27
|
+
|
30
28
|
def self.configurable?
|
31
29
|
config_class
|
32
30
|
end
|
@@ -5,10 +5,24 @@ module StatusPage
|
|
5
5
|
class RedisException < StandardError; end
|
6
6
|
|
7
7
|
class Redis < Base
|
8
|
+
class Configuration
|
9
|
+
attr_accessor :url
|
10
|
+
|
11
|
+
def initialize
|
12
|
+
@url = "redis://127.0.0.1:3306/1"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class << self
|
17
|
+
def config_class
|
18
|
+
Redis::Configuration
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
8
22
|
def check!
|
9
23
|
time = Time.now.to_s(:db)
|
10
24
|
|
11
|
-
redis = ::Redis.
|
25
|
+
redis = ::Redis.new(url: config.url)
|
12
26
|
redis.set(key, time)
|
13
27
|
fetched = redis.get(key)
|
14
28
|
|
@@ -29,7 +29,7 @@ module StatusPage
|
|
29
29
|
private
|
30
30
|
|
31
31
|
def config_class
|
32
|
-
Configuration
|
32
|
+
Sidekiq::Configuration
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
@@ -44,7 +44,6 @@ module StatusPage
|
|
44
44
|
latency = ::Sidekiq::Queue.new.latency
|
45
45
|
|
46
46
|
return unless latency > config.latency
|
47
|
-
|
48
47
|
raise "latency #{latency} is greater than #{config.latency}"
|
49
48
|
end
|
50
49
|
|
data/lib/status-page/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: status-page
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leonid Beder
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-11-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -70,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
70
70
|
version: '0'
|
71
71
|
requirements: []
|
72
72
|
rubyforge_project:
|
73
|
-
rubygems_version: 2.
|
73
|
+
rubygems_version: 2.5.2
|
74
74
|
signing_key:
|
75
75
|
specification_version: 4
|
76
76
|
summary: Health monitoring Rails plug-in, which checks various services (db, cache,
|