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 +4 -4
- data/README.md +47 -1
- data/assets/images/logo_sc4ry.png +0 -0
- data/assets/logo_sc4ry.png +0 -0
- data/lib/sc4ry/logger.rb +1 -1
- data/lib/sc4ry/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0cf4e754e862f6af5921390386a8138d61168ca2dcc74be2af5024d554c16d27
|
4
|
+
data.tar.gz: f3b6bd16ed96d045058e2d05b7c7c24eb0e8feb9c57368301489f76d6fe1e4c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
data/lib/sc4ry/version.rb
CHANGED
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.
|
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-
|
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
|