protoboard 0.1.4 → 0.1.5
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/Gemfile.lock +1 -1
- data/README.md +3 -1
- data/lib/protoboard/circuit_breaker.rb +3 -3
- data/lib/protoboard/helpers/services_healthcheck_generator.rb +14 -2
- data/lib/protoboard/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c81cf53f96503f2eb2e797e9e7034abe3f1fde97
|
4
|
+
data.tar.gz: d394dde7965c0a5334cbe7dc2ce1fa5ee1f656f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4e889e92fa0a9f0e255bb30b25a965d244b05987d4edad86f2f0906f2258704c1892b81a2b325e44f9088febe06b365dfdc293bdd34ff53150cc550b233b01c
|
7
|
+
data.tar.gz: 31095568cddf438c81fd6b5794674874eed45e870fe2647154bbbfa75cc04307ba7fefdab85e4609c2c1d8e19df45dc5c6ecbdf4ce51ded17cbbe5489220f47a
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -103,13 +103,15 @@ If you want to check the services and circuits registered in Protoboard you can
|
|
103
103
|
'my_service_name' => {
|
104
104
|
'circuits' => {
|
105
105
|
'some_namespace/my_service_name/SomeClass#some_method' => 'OK',
|
106
|
-
'my_custom_name' => 'NOT_OK'
|
106
|
+
'some_namespace/my_custom_name' => 'NOT_OK'
|
107
107
|
}
|
108
108
|
}
|
109
109
|
}
|
110
110
|
}
|
111
111
|
```
|
112
112
|
|
113
|
+
PS: You can also disable the project namespace to be shown in `Protoboard::CircuitBreaker.services_healthcheck` passing the option `with_namespace: false`
|
114
|
+
|
113
115
|
|
114
116
|
## Configuration
|
115
117
|
|
@@ -54,8 +54,8 @@ module Protoboard
|
|
54
54
|
class << self
|
55
55
|
##
|
56
56
|
# Returns a hash with the +circuits+ names and its states.
|
57
|
-
def services_healthcheck
|
58
|
-
Protoboard::Helpers::ServicesHealthcheckGenerator.new.call
|
57
|
+
def services_healthcheck(with_namespace: true)
|
58
|
+
Protoboard::Helpers::ServicesHealthcheckGenerator.new.call(with_namespace: with_namespace)
|
59
59
|
end
|
60
60
|
|
61
61
|
##
|
@@ -91,7 +91,7 @@ module Protoboard
|
|
91
91
|
memo.merge(value.to_sym => "#{formatted_namespace}#{options[:service]}/#{class_name}\##{value}")
|
92
92
|
end
|
93
93
|
when Hash
|
94
|
-
circuit_methods
|
94
|
+
circuit_methods.map { |key, value| [key, "#{formatted_namespace}#{value}"] }.to_h
|
95
95
|
else
|
96
96
|
raise ArgumentError, 'Invalid input for circuit methods'
|
97
97
|
end
|
@@ -22,7 +22,7 @@ module Protoboard
|
|
22
22
|
# }
|
23
23
|
# ====
|
24
24
|
#
|
25
|
-
def call
|
25
|
+
def call(with_namespace:)
|
26
26
|
circuits_hash = Protoboard::CircuitBreaker.registered_circuits.map do |circuit|
|
27
27
|
state = Protoboard.config.adapter.check_state(circuit.name)
|
28
28
|
|
@@ -31,12 +31,24 @@ module Protoboard
|
|
31
31
|
services_hash = circuits_hash
|
32
32
|
.group_by { |circuit| circuit[:service] }
|
33
33
|
.map do |service, circuits_hash|
|
34
|
-
|
34
|
+
|
35
|
+
circuits = circuits_hash.each_with_object({}) do |circuit, memo|
|
36
|
+
circuit_name = format_circuit_name(circuit[:name], with_namespace: with_namespace)
|
37
|
+
memo[circuit_name] = circuit[:status]
|
38
|
+
end
|
35
39
|
{ service => { 'circuits' => circuits } }
|
36
40
|
end.reduce(:merge)
|
37
41
|
|
38
42
|
{ 'services' => services_hash.to_h }
|
39
43
|
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
def format_circuit_name(circuit_name, with_namespace:)
|
48
|
+
return circuit_name if with_namespace
|
49
|
+
|
50
|
+
circuit_name.sub("#{Protoboard.config.namespace}/", '')
|
51
|
+
end
|
40
52
|
end
|
41
53
|
end
|
42
54
|
end
|
data/lib/protoboard/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protoboard
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carlos Atkinson
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-06-
|
12
|
+
date: 2018-06-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: dry-configurable
|