sc4ry 0.1.0 → 0.1.1

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: ad841dbab3af84cbf8d7153d083add74200824d502a73aacc6d452f8e42a58d8
4
- data.tar.gz: 7a6fdee9c2e076ba750adcd421bbf1d2115acd9db7778b75e6ffe475234d4db3
3
+ metadata.gz: 0cf4e754e862f6af5921390386a8138d61168ca2dcc74be2af5024d554c16d27
4
+ data.tar.gz: f3b6bd16ed96d045058e2d05b7c7c24eb0e8feb9c57368301489f76d6fe1e4c5
5
5
  SHA512:
6
- metadata.gz: dc1df50beebe4fb869ee88118c0cd922c45a02a79bf64b3f5dd9f539942980e0003b1444a1928f6ef0fced339a7672f8b6a65de463cec7ae87976a0c6f7e074e
7
- data.tar.gz: 3b0d6aed86e5196a7ac829c6efe692d621a410933f2b0213ba37b6fc56748b405e036195cd91375ba581b71a6bfe24d7386fc8335ba600ebc0e0913f2db86f9b
6
+ metadata.gz: ed8241fdf174a9c6f6be4e61ada6627c62a246d574910bb83579fec77a0e919227bae3b2a1c00d3cfd469e5fbcab134d275fa19c7566536120901073ffee8ba0
7
+ data.tar.gz: 3d20056f6e08c289307beef56473f71e1a60b115d38ff119e0177317ffb8fca6b336451c62437fd8d7eb737463234b9734b962ddf02a936e3afc692d0588c0d5
data/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Sc4ry provide the Circuit Breaker Design Pattern for your applications
4
4
 
5
+ ![Sc4ry logo](assets/images/logo_sc4ry.png) _Simple CircuitBreacker 4 RubY_
6
+
5
7
  ## Installation
6
8
 
7
9
  Add this line to your application's Gemfile:
@@ -20,7 +22,51 @@ Or install it yourself as:
20
22
 
21
23
  ## Usage
22
24
 
23
- TODO: Write usage instructions here
25
+ ### sample with Restclient
26
+
27
+ ```ruby
28
+
29
+ require 'rubygems'
30
+ require 'sc4ry'
31
+
32
+
33
+ # defining a circuit, config must be empty or override from default
34
+ Sc4ry::Circuits.register({:circuit =>:test, :config => {:notifiers => [:prometheus, :mattermost], :exceptions => [Errno::ECONNREFUSED], :timeout => true, :timeout_value => 3, :check_delay => 5 }})
35
+
36
+ # display the list of known circuit
37
+ pp Sc4ry::Circuits.list
38
+
39
+ # display default config, must be override with a nested hash by calling default_config= method
40
+ pp Sc4ry::Circuits.default_config
41
+
42
+ # default values, circuit is half open before one of the max count is reached
43
+
44
+ # {:max_failure_count=>5, => maximum failure before opening circuit
45
+ # :timeout_value=>20, => timeout value, if :timeout => true
46
+ # :timeout=>false, => activate internal timeout
47
+ # :max_timeout_count=>5, => maximum timeout try before opening circuit
48
+ # :max_time=>10, => maximum time for a circuit run
49
+ # :max_overtime_count=>3, => maximum count of overtime before opening circuit
50
+ # :check_delay=>30, => delay after opening, before trying again to closed circuit or after an other check
51
+ # :notifiers=>[], => active notifier, must be :symbol in [:prometheus, :mattermost]
52
+ # :exceptions=>[StandardError, RuntimeError]} => list of selected Exceptions considered for failure, others are SKIPPED.
53
+
54
+ # display configuration for a specific circuit
55
+ pp Sc4ry::Circuits.get circuit: :test
56
+
57
+ # sample Mattermost notification
58
+ #Sc4ry::Notifiers::config({:name => :mattermost, :config => {:url => 'https://mattermost.mycorp.com', :token => "<TOKEN>"}})
59
+
60
+ # sample loop
61
+ 100.times do
62
+ sleep 1
63
+ Sc4ry::Circuits.run circuit: :test do
64
+ # for the test choose or build an endpoint you must shutdown
65
+ puts RestClient.get('http://<URL_OF_A_ENDPOINT>')
66
+ end
67
+ end
68
+
69
+ ```
24
70
 
25
71
  ## Development
26
72
 
Binary file
Binary file
data/lib/sc4ry/logger.rb CHANGED
@@ -18,7 +18,7 @@ module Sc4ry
18
18
  end
19
19
 
20
20
  def Logger.current=(sym)
21
- raise "Logger not define : #{sim}" unless @@loggers.keys.include? sim
21
+ raise "Logger not define : #{sym}" unless @@loggers.keys.include? sym
22
22
  @@default = sym
23
23
  end
24
24
 
data/lib/sc4ry/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Sc4ry
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sc4ry
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
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-02-21 00:00:00.000000000 Z
11
+ date: 2022-03-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Sc4ry provide the design pattern Circuit breaker for your application.
14
14
  email:
@@ -23,6 +23,8 @@ files:
23
23
  - LICENSE.txt
24
24
  - README.md
25
25
  - Rakefile
26
+ - assets/images/logo_sc4ry.png
27
+ - assets/logo_sc4ry.png
26
28
  - bin/console
27
29
  - bin/setup
28
30
  - lib/sc4ry.rb