sc4ry 0.1.4 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 63f7aa01b54f949abb2f4dd1443fd8b42a16346673200e9394d091dafc5efb06
4
- data.tar.gz: fbed3c85b892cf1997100ed7753a48f51bcfff106285071083e4f6fc6845b7c3
3
+ metadata.gz: 86e9653534207c3b9809325a04d64da78f0636a1e62d800729cc15737ae0acf3
4
+ data.tar.gz: 1c00863a8330914acf9aea73f6022d7afaef73be50b3341f01e21a7490244125
5
5
  SHA512:
6
- metadata.gz: 2435573c1f5e0d1476548f2d581f4a00029d6c8d67a4824402e8de3b5b3528cc32d307149e61ad1cd751fb3561a43cd75c6ae7791888c1c8048258ce2c9fcfd8
7
- data.tar.gz: 9bd96086e6cc1260c9e1e43df45b4743d2d8c8d4df5d4ae23eb8af32822960304aa38d363626ca816895861eed79839ca0f3311995ad301904fc941aef8fc6e0
6
+ metadata.gz: 37c78c76dbb4a2a636ebbeb2bd70ac45949aa89983adda27810fb0bc3cf49078ef2e94e10b02f105ee6354109e2efeef9ed3f2b22678645fcf79e0cf097f0536
7
+ data.tar.gz: e32fe7cb84723bfcbbb1a90634d55cd3922c42bedb3e98c93d80f817ee6236ca966196c067a410a44affd04ff00c21560cdf18c702ad8e3f727e37ff9b248fbe
data/README.md CHANGED
@@ -39,16 +39,24 @@ pp Sc4ry::Circuits.list
39
39
  # display default config, must be override with a nested hash by calling default_config= method
40
40
  pp Sc4ry::Circuits.default_config
41
41
 
42
+
43
+ # Config an alternate logger
44
+ Sc4ry::Logger.register name: :perso, instance: ::Logger.new('/tmp/logfile.log')
45
+ Sc4ry::Logger::current = :perso
46
+
47
+
42
48
  # default values, circuit is half open before one of the max count is reached
43
49
 
44
50
  # {:max_failure_count=>5, => maximum failure before opening circuit
45
51
  # :timeout_value=>20, => timeout value, if :timeout => true
46
- # :timeout=>false, => activate internal timeout
52
+ # :timeout=>false, => (de)activate internal timeout
47
53
  # :max_timeout_count=>5, => maximum timeout try before opening circuit
48
54
  # :max_time=>10, => maximum time for a circuit run
49
55
  # :max_overtime_count=>3, => maximum count of overtime before opening circuit
50
56
  # :check_delay=>30, => delay after opening, before trying again to closed circuit or after an other check
51
57
  # :notifiers=>[], => active notifier, must be :symbol in [:prometheus, :mattermost]
58
+ # :forward_unknown_exceptions => true, => (de)activate forwarding of unknown exceptions, just log in DEBUG if false
59
+ # :raise_on_opening => false, => (de)activate raise specific Sc4ry exceptions ( CircuitBreaked ) if circuit opening
52
60
  # :exceptions=>[StandardError, RuntimeError]} => list of selected Exceptions considered for failure, others are SKIPPED.
53
61
 
54
62
  # display configuration for a specific circuit
@@ -20,6 +20,12 @@ module Sc4ry
20
20
  return @@config
21
21
  end
22
22
 
23
+ def Circuits.default_config=(config)
24
+ @@config = config
25
+ @@config[:exceptions].map! {|item| item = Object.const_get item if item.class == String}
26
+
27
+ end
28
+
23
29
  def Circuits.register(options = {})
24
30
  raise ":circuit is mandatory" unless options[:circuit]
25
31
  name = options[:circuit]
data/lib/sc4ry/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sc4ry
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.7"
3
3
  end
data/sc4ry.gemspec CHANGED
@@ -19,4 +19,9 @@ Gem::Specification.new do |spec|
19
19
  `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
20
20
  end
21
21
  spec.require_paths = ["lib"]
22
+
23
+ spec.add_dependency "prometheus-client", "~> 3.0"
24
+ spec.add_dependency "rest-client", "~> 2.1"
25
+
26
+
22
27
  end
metadata CHANGED
@@ -1,15 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sc4ry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Romain GEORGES
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-02 00:00:00.000000000 Z
12
- dependencies: []
11
+ date: 2022-03-08 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: prometheus-client
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '3.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '3.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rest-client
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.1'
13
41
  description: Sc4ry provide the design pattern Circuit breaker for your application.
14
42
  email:
15
43
  - romain.georges@orange.com