tribune-is_it_working 1.1.1 → 1.1.2
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/lib/is_it_working/filter.rb +4 -3
- data/lib/is_it_working/handler.rb +4 -1
- data/lib/is_it_working/status.rb +3 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c06c40921e40bbcd62cb5442f165837704997ed0676bfa6ffedcbdec26886b10
|
4
|
+
data.tar.gz: 046d065c1c02741933ecc2df05867014cbf6ad262f66f596ae31d234b3fcce34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3dcd717dea11e62123bae07dc0f8cc031e9ff6aca8bb8389b9ce605964065b045f763b8aa63c1fa50707cb8e10b01a68cb9d7dd8cf55e38eb105cfd5a4817f1
|
7
|
+
data.tar.gz: e18cdba1a5ff9767468717dae3d2fabe1a8ec4f68273d2f7c09b26779f62939219169b63e63a72b796ed7154d09c7652693abd67b3e5ebe704cfdf2560e8053a
|
data/lib/is_it_working/filter.rb
CHANGED
@@ -19,12 +19,13 @@ module IsItWorking
|
|
19
19
|
attr_reader :name, :async
|
20
20
|
|
21
21
|
# name and description of Component
|
22
|
-
attr_reader :component_name, :description
|
22
|
+
attr_reader :component_name, :component_type, :description
|
23
23
|
|
24
24
|
# Create a new filter to run a status check. The name is used for display purposes.
|
25
|
-
def initialize(name, component_name, description, check, async = true)
|
25
|
+
def initialize(name, component_name, component_type, description, check, async = true)
|
26
26
|
@name = name
|
27
27
|
@component_name = component_name
|
28
|
+
@component_type = component_type
|
28
29
|
@description = description
|
29
30
|
@check = check
|
30
31
|
@async = async
|
@@ -33,7 +34,7 @@ module IsItWorking
|
|
33
34
|
# Run a status the status check. This method keeps track of the time it took to run
|
34
35
|
# the check and will trap any unexpected exceptions and report them as failures.
|
35
36
|
def run
|
36
|
-
status = IsItWorking::Status.new(name, component_name, description)
|
37
|
+
status = IsItWorking::Status.new(name, component_name, component_type, description)
|
37
38
|
runner = (async ? AsyncRunner : SyncRunner).new do
|
38
39
|
t = Time.now
|
39
40
|
begin
|
@@ -104,9 +104,11 @@ module IsItWorking
|
|
104
104
|
# New Params:
|
105
105
|
# @param: component_name [String] optional
|
106
106
|
# => for which component checking health-check (ex: dss-url, zephr-url, active_record etc)
|
107
|
+
# @param: component_type [String] optional
|
108
|
+
# => for which component_type checking health-check (ex: Database, MemCache etc)
|
107
109
|
# @param: description [String] optional
|
108
110
|
# => Description for health-check for component
|
109
|
-
@filters << IsItWorking::Filter.new(name, options[:component_name],
|
111
|
+
@filters << IsItWorking::Filter.new(name, options[:component_name], options[:component_type],
|
110
112
|
options[:description], check, options[:async])
|
111
113
|
end
|
112
114
|
|
@@ -169,6 +171,7 @@ module IsItWorking
|
|
169
171
|
status.messages.each do |m|
|
170
172
|
message = { name: status.name,
|
171
173
|
component_name: status.component_name,
|
174
|
+
component_type: status.component_type,
|
172
175
|
info: "#{m.message} (#{status.time ? sprintf('%0.000f', status.time * 1000) : '?'}ms)",
|
173
176
|
time: status.time,
|
174
177
|
success: m.ok? ? true : false,
|
data/lib/is_it_working/status.rb
CHANGED
@@ -22,7 +22,7 @@ module IsItWorking
|
|
22
22
|
attr_reader :name
|
23
23
|
|
24
24
|
# name and description of Component
|
25
|
-
attr_reader :component_name, :description
|
25
|
+
attr_reader :component_name, :component_type, :description
|
26
26
|
|
27
27
|
# The messages set on the status check.
|
28
28
|
attr_reader :messages
|
@@ -30,9 +30,10 @@ module IsItWorking
|
|
30
30
|
# The amount of time it takes to complete the status check.
|
31
31
|
attr_accessor :time
|
32
32
|
|
33
|
-
def initialize(name, component_name, description)
|
33
|
+
def initialize(name, component_name, component_type, description)
|
34
34
|
@name = name
|
35
35
|
@component_name = component_name
|
36
|
+
@component_type = component_type
|
36
37
|
@description = description
|
37
38
|
@messages = []
|
38
39
|
end
|