semian 0.12.0 → 0.13.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/CHANGELOG.md +243 -0
- data/LICENSE.md +21 -0
- data/README.md +836 -0
- data/ext/semian/extconf.rb +21 -19
- data/lib/semian/adapter.rb +8 -4
- data/lib/semian/circuit_breaker.rb +16 -10
- data/lib/semian/grpc.rb +32 -10
- data/lib/semian/instrumentable.rb +2 -0
- data/lib/semian/lru_hash.rb +15 -14
- data/lib/semian/mysql2.rb +13 -9
- data/lib/semian/net_http.rb +10 -4
- data/lib/semian/platform.rb +3 -1
- data/lib/semian/protected_resource.rb +5 -3
- data/lib/semian/rails.rb +33 -6
- data/lib/semian/redis.rb +16 -14
- data/lib/semian/redis_client.rb +5 -3
- data/lib/semian/resource.rb +5 -3
- data/lib/semian/simple_integer.rb +4 -2
- data/lib/semian/simple_sliding_window.rb +5 -3
- data/lib/semian/simple_state.rb +3 -1
- data/lib/semian/unprotected_resource.rb +2 -0
- data/lib/semian/version.rb +3 -1
- data/lib/semian.rb +61 -45
- metadata +11 -201
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 540294c5a9ecdfdcbafcdc1485afd1314a94fd869501bc6795ee327606d3e799
|
4
|
+
data.tar.gz: 5855959232d25ea3c2da1f7ca7096c18afb15161ac8116e8f1ece9792fd456e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7549cd0c6dc515733612fcd7b200c23467104c5616ff9501b65a554712e0449d07d8d2d479b45962cffb87c8e6cd2fc82d695a1d9f399a5724b3b4c241c59a8
|
7
|
+
data.tar.gz: cf31ff975016b22e101db10813d73ab8288584657c9f7319ef222790dcd052d3ab45caedcca2639140d2199be87d1f790f0c82edf918d388c669f9be68b467f2
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,243 @@
|
|
1
|
+
# Unreleased
|
2
|
+
|
3
|
+
# v0.13.2
|
4
|
+
|
5
|
+
* Fix: Update AbstractAdapter patch to accomodate recent Rails changes. (#364)
|
6
|
+
|
7
|
+
# v0.13.1
|
8
|
+
|
9
|
+
* Fix: Raise `Redis::OutOfMemoryError` for messages that match `OOM command not allowed when used memory > 'maxmemory'` rather than checking `start_with?("OOM ")`. (#367)
|
10
|
+
|
11
|
+
# v0.13.0
|
12
|
+
|
13
|
+
* Refactor: Replace Time.now with CLOCK_MONOTONIC in MockServer (#318)
|
14
|
+
* Fix: Circuit not open for GRPC::ActiveCall::Operation failures (#348)
|
15
|
+
|
16
|
+
# v0.12.0
|
17
|
+
|
18
|
+
* Feature: Add support for the `redis-client` gem (#314)
|
19
|
+
|
20
|
+
# v0.11.8
|
21
|
+
|
22
|
+
* Feature: Add error_threshold_timeout configuration parameter (#299)
|
23
|
+
|
24
|
+
# v0.11.7
|
25
|
+
|
26
|
+
* Fix: ECONNRESET won't trigger circuit open for redis (#306)
|
27
|
+
|
28
|
+
# v0.11.6
|
29
|
+
|
30
|
+
* Fix: pass disable flag by patching new singleton method (#303)
|
31
|
+
|
32
|
+
# v0.11.5
|
33
|
+
|
34
|
+
* Feature: Add disable flag to http adapter (#301)
|
35
|
+
|
36
|
+
# v0.11.4
|
37
|
+
|
38
|
+
* Fix: Add `extern` to global variable declarations for gcc 10 (#288)
|
39
|
+
|
40
|
+
# v0.11.3
|
41
|
+
|
42
|
+
* Feature: Log last error message on circuit breaker state transition (#285)
|
43
|
+
* Fix: Update README and docs to resolve common misconception about error_threshold (#283)
|
44
|
+
|
45
|
+
# v0.11.2
|
46
|
+
|
47
|
+
* Fix: Remove `MySQL client is not connected` error from mysql2 adapter
|
48
|
+
|
49
|
+
# v0.11.1
|
50
|
+
|
51
|
+
* Feature: Add `Semian.namespace` to globally prefix all the semaphore names. (#280)
|
52
|
+
|
53
|
+
# v0.11.0
|
54
|
+
|
55
|
+
* Feature: Add `Semian.default_permissions` to globally change the default semaphore permissions. (#279)
|
56
|
+
|
57
|
+
# v0.10.6
|
58
|
+
|
59
|
+
* Fix: Match whitelisted SQL queries when Marginalia is prepended (#276)
|
60
|
+
|
61
|
+
# v0.10.5
|
62
|
+
|
63
|
+
* Fix: Compatibility with GC.compact
|
64
|
+
|
65
|
+
# v0.10.4
|
66
|
+
|
67
|
+
* Fix: Revert the changes in v0.10.3. (#270)
|
68
|
+
|
69
|
+
# v0.10.3
|
70
|
+
|
71
|
+
* Fix: Positional/Keyword arguments deprecations warning for Ruby 2.7 in the grpc adapter. (#269)
|
72
|
+
|
73
|
+
# v0.10.2
|
74
|
+
|
75
|
+
* Fix: Positional/Keyword arguments deprecations warning for Ruby 2.7.
|
76
|
+
|
77
|
+
# v0.10.1
|
78
|
+
|
79
|
+
* Fix: thread safety bug on Ruby 2.7. (#263)
|
80
|
+
|
81
|
+
# v0.10.0
|
82
|
+
|
83
|
+
* Feature: Support half open resource timeout for redis.
|
84
|
+
|
85
|
+
# v0.9.1
|
86
|
+
|
87
|
+
* Fix: Compatibility with MRI 2.3
|
88
|
+
|
89
|
+
# v0.9.0
|
90
|
+
|
91
|
+
* Feature: Add a LRU to garbage collect old resources. (#193)
|
92
|
+
|
93
|
+
# v0.8.9
|
94
|
+
* Fix: Recursion issue in MySQL2 adapter causing circuits breakers to stay open much longer than they should. (#250)
|
95
|
+
* Fix: Better handle DNS resolutions exceptions in Redis adapter. (#230)
|
96
|
+
|
97
|
+
# v0.8.8
|
98
|
+
* Feature: Introduce the GRPC adapter (#200)
|
99
|
+
|
100
|
+
# v0.8.7
|
101
|
+
* Fix: Instrument success for `acquire_circuit_breaker` (#209)
|
102
|
+
|
103
|
+
# v0.8.6
|
104
|
+
* Feature: If an error instance responds to `#marks_semian_circuits?` don't mark the circuit if it returns false (#210)
|
105
|
+
|
106
|
+
# v0.8.5
|
107
|
+
* Fix: Redis adapter using hiredis is resilient to DNS resolution failures (#205)
|
108
|
+
|
109
|
+
# v0.8.4
|
110
|
+
* Feature: Introduce `half_open_resource_timeout` which changes the resource timeout when the circuit is in a half-open state for the Net::HTTP adapter. (#198)
|
111
|
+
* Feature: Add the cause of the last error when a circuit opens (#197)
|
112
|
+
* Fix: Reset successes when transitioning to the half open state (#192)
|
113
|
+
|
114
|
+
# v0.8.1
|
115
|
+
|
116
|
+
* Fix: Expose `half_open?` when the circuit state has not transitioned but will. This allows consumers further up the stack to know if the circuit
|
117
|
+
is half open.
|
118
|
+
|
119
|
+
# v0.8.0
|
120
|
+
|
121
|
+
* Feature: Introduce `half_open_resource_timeout` which changes the resource timeout when the circuit is in a half-open state (#188)
|
122
|
+
|
123
|
+
# v0.7.8
|
124
|
+
|
125
|
+
* Feature: More informative error messages when initializing Semian with missing
|
126
|
+
arguments (#182)
|
127
|
+
* Fix: Redis adapter is now resilient to DNS resolution failures (#184)
|
128
|
+
|
129
|
+
# v0.7.5
|
130
|
+
|
131
|
+
* Fix: Repaired compatibility with dependent Redis library
|
132
|
+
|
133
|
+
# v0.7.4
|
134
|
+
|
135
|
+
* Fix: Protect internal semaphore when adjusting resource count (#164)
|
136
|
+
* Feature: Use prepend when monkey-patching Net::HTTP. (#157)
|
137
|
+
* Feature: Include time spend waiting for bulkhead in notification (#154)
|
138
|
+
|
139
|
+
# v0.7.1
|
140
|
+
|
141
|
+
* Feature: Add the behaviour to enable open circuiting on 5xxs conditionally (#149)
|
142
|
+
* Refactor: Configurable hosts for Semian's development dependencies (#152)
|
143
|
+
|
144
|
+
# v0.7.0
|
145
|
+
|
146
|
+
This change introduced a series of changes to support a new "dynamic quota" ticket
|
147
|
+
allocation strategy. This code primarily affects bulkheads (protected resources).
|
148
|
+
|
149
|
+
Rather than statically setting a ticket count, workers (in their own process) now register
|
150
|
+
themselves. By specifying 'quota' instead of 'tickets', the bulkhead threshold will now be
|
151
|
+
computed dynamically as a ratio of the number of registered workers, eliminating the need to
|
152
|
+
continuously readjust ticket counts, and supporting environments with non-uniform worker
|
153
|
+
distribution between machines.
|
154
|
+
|
155
|
+
* Feature: Support quota based allocation strategy (#120)
|
156
|
+
* Feature: Add ability to manually unregister workers (#130)
|
157
|
+
* Feature: Add ability to clear resources from adapters and unregister all resources (#134)
|
158
|
+
* Feature: Allow sysV IPC key to be accessed in ruby (#136)
|
159
|
+
* Feature: Expose registered worker count to ruby (#137)
|
160
|
+
* Refactor: Allow registered worker count to be accessed through bulkhead (#138)
|
161
|
+
* Bug fix: Register all workers (#128)
|
162
|
+
* Bug fix: Lazy instantiate redis clien on first I/O (#132)
|
163
|
+
* Bug fix: New mysql error (#131)
|
164
|
+
* Bug fix: Prevent race conditions when unregistering (#141)
|
165
|
+
* Refactor/Feature: Break coupling between resource and circuit breaker (#123)
|
166
|
+
* Refactor: Use generic max_sem_val (#117)
|
167
|
+
* Refactor: Fix header syntax (#118)
|
168
|
+
* Refactor: Always acquire semaphore without_gvl (#121)
|
169
|
+
* Thread-safety for circuit breakers by default (#150)
|
170
|
+
* Fix bug where calling name on a protected resource without a semaphore would fail (#151)
|
171
|
+
|
172
|
+
# v0.6.2
|
173
|
+
|
174
|
+
* Refactor: Refactor semian ticket management into its own files (#116)
|
175
|
+
* Refactor: Create sem_meta_lock and sem_meta_unlock (#115)
|
176
|
+
* Refactor: Refactor semaphore operations (#114)
|
177
|
+
|
178
|
+
# v0.6.1
|
179
|
+
|
180
|
+
* Refactor: Generate a unique semaphore key by including size of semaphore set
|
181
|
+
* Refactor: Refactor semian\_resource related C functions
|
182
|
+
* Fix: Don't require sudo for travis (#110)
|
183
|
+
* Refactor: Refactor semian.c includes and types into header files
|
184
|
+
* Fix: Use glob instead of git for gemspec file list
|
185
|
+
* Fix: Fix travis CI for ruby 2.3.0 installing rainbows
|
186
|
+
* Refactor: Switch to enumerated type for tracking semaphore indices
|
187
|
+
* Docs: readme: explain co-operation between cbs and bulkheads
|
188
|
+
* Docs: readme: add section about server limits
|
189
|
+
|
190
|
+
# v0.6.0
|
191
|
+
|
192
|
+
* Feature: Load semian/rails automatically if necessary
|
193
|
+
* Feature: Implement AR::AbstractAdapter#semian\_resource
|
194
|
+
|
195
|
+
# v0.5.4
|
196
|
+
|
197
|
+
* Fix: Also let "Too many connections" be a first class conn error
|
198
|
+
|
199
|
+
# v0.5.3
|
200
|
+
|
201
|
+
* Fix: mysql: protect pings
|
202
|
+
* Fix: mysql: match more lost conn queries
|
203
|
+
|
204
|
+
# v0.5.2
|
205
|
+
|
206
|
+
* Fix: Make request\_allowed? thread safe
|
207
|
+
* Fix: Fix CI connect errors on HTTP requests by using 127.0.0.1 for host
|
208
|
+
|
209
|
+
# v0.5.1
|
210
|
+
|
211
|
+
* Fix: Assert Resource#initialize\_semaphore contract on Resource init
|
212
|
+
* Fix: Lock on older thin version for pre MRI 2.2 compatibility
|
213
|
+
|
214
|
+
# v0.5.0
|
215
|
+
|
216
|
+
* Fix: Only issue unsupported or disabled semaphores warnings when the first resource is instanciated
|
217
|
+
* Refactor: Cleanup requires
|
218
|
+
* Maintenance: Use published version of the toxiproxy gem
|
219
|
+
* Fix: Fix minitest deprecation warnings
|
220
|
+
* Maintenance: Update bundler on travis
|
221
|
+
* Maintenance: Update supported MRI versions on travis
|
222
|
+
|
223
|
+
# v0.4.3
|
224
|
+
|
225
|
+
* Fix: Fix lazy aliasing of Redis#semian\_resource
|
226
|
+
* Fix: Workaround rubocop parser limitations
|
227
|
+
|
228
|
+
# v0.4.2
|
229
|
+
|
230
|
+
* Fix: Fix for TimeoutError is deprecated in Ruby 2.3.0
|
231
|
+
* Feature: Include Ruby 2.3 in Travis builds
|
232
|
+
|
233
|
+
# v0.4.1
|
234
|
+
* Fix: resource: cast float ticket count to fixnum #75
|
235
|
+
|
236
|
+
# v0.4.0
|
237
|
+
|
238
|
+
* Feature: net/http: add adapter for net/http #58
|
239
|
+
* Refactor: circuit_breaker: split circuit breaker into three data structures to allow for
|
240
|
+
alternative implementations in the future #62
|
241
|
+
* Fix: mysql: don't prevent rollbacks on transactions #60
|
242
|
+
* Fix: core: fix initialization bug when the resource is accessed before the options
|
243
|
+
are set #65
|
data/LICENSE.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Shopify
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|