freno-client 0.8.3 → 0.10.0
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/README.md +78 -3
- data/freno-client.gemspec +15 -10
- data/lib/freno/client/errors.rb +2 -1
- data/lib/freno/client/preconditions.rb +3 -4
- data/lib/freno/client/version.rb +1 -1
- data/lib/freno/client.rb +1 -1
- data/lib/freno/throttler/errors.rb +7 -0
- data/lib/freno/throttler.rb +81 -21
- metadata +57 -62
- data/.github/workflows/ruby.yml +0 -35
- data/.gitignore +0 -13
- data/.rubocop.yml +0 -48
- data/CODE_OF_CONDUCT.md +0 -74
- data/CONTRIBUTING.md +0 -32
- data/Gemfile +0 -18
- data/Rakefile +0 -15
- data/gemfiles/faraday_0.gemfile +0 -22
- data/gemfiles/faraday_1.gemfile +0 -22
- data/gemfiles/faraday_2.gemfile +0 -22
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4715bae7724513dca1402c0a15d8e5ad46009a67b9b6ea578f89a3ffbc7752cb
|
|
4
|
+
data.tar.gz: 646cb16cbd0b47093f9f6ade58e1da3877e83023e73ed8d1eefc6644e293405b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: da8ed8de2d0526e42f4cc29edacc1f09512c7d843c6ca4b00f094d76fa87f15a1f1b1687ab394efc118004814dc2bf8f65849402aa93904c292ec808d649a7e2
|
|
7
|
+
data.tar.gz: 9015593fd377b5ce44f5912f12906e2bd1def7e6a31430c46cdf1a9fc168fde41eec19d1127adeda657af43c6ca210eafb140eb18b57d8fd3367d798caa820d3
|
data/README.md
CHANGED
|
@@ -202,6 +202,7 @@ module Freno
|
|
|
202
202
|
|
|
203
203
|
DEFAULT_WAIT_SECONDS = 0.5
|
|
204
204
|
DEFAULT_MAX_WAIT_SECONDS = 10
|
|
205
|
+
DEFAULT_MAX_RETRIES = 4
|
|
205
206
|
|
|
206
207
|
def initialize(client: nil,
|
|
207
208
|
app: nil,
|
|
@@ -209,7 +210,10 @@ module Freno
|
|
|
209
210
|
instrumenter: Instrumenter::Noop,
|
|
210
211
|
circuit_breaker: CircuitBreaker::Noop,
|
|
211
212
|
wait_seconds: DEFAULT_WAIT_SECONDS,
|
|
212
|
-
max_wait_seconds: DEFAULT_MAX_WAIT_SECONDS
|
|
213
|
+
max_wait_seconds: DEFAULT_MAX_WAIT_SECONDS,
|
|
214
|
+
jitter: true,
|
|
215
|
+
backoff: true,
|
|
216
|
+
max_retries: DEFAULT_MAX_RETRIES)
|
|
213
217
|
|
|
214
218
|
|
|
215
219
|
@client = client
|
|
@@ -219,6 +223,9 @@ module Freno
|
|
|
219
223
|
@circuit_breaker = circuit_breaker
|
|
220
224
|
@wait_seconds = wait_seconds
|
|
221
225
|
@max_wait_seconds = max_wait_seconds
|
|
226
|
+
@jitter = jitter
|
|
227
|
+
@backoff = backoff
|
|
228
|
+
@max_retries = max_retries
|
|
222
229
|
|
|
223
230
|
yield self if block_given?
|
|
224
231
|
|
|
@@ -233,10 +240,78 @@ end
|
|
|
233
240
|
A Throttler instance will make calls to freno on behalf of the given `app`,
|
|
234
241
|
using the given `client` (an instance of `Freno::Client`).
|
|
235
242
|
|
|
236
|
-
|
|
243
|
+
`wait_seconds` is the minimum retry delay. `max_wait_seconds` is both the
|
|
244
|
+
upper bound for an individual delay and the total sleep budget. Both must
|
|
245
|
+
be positive finite numbers, with `max_wait_seconds` greater than
|
|
246
|
+
`wait_seconds`. Defaults are 0.5 and 10 seconds; caller overrides are used
|
|
247
|
+
directly, not replaced with fixed caps.
|
|
248
|
+
|
|
249
|
+
Backoff grows the base intervals geometrically from `wait_seconds` to
|
|
250
|
+
`max_wait_seconds` across the allowed retry slots. With four retries and
|
|
251
|
+
the defaults, the bases are approximately 0.5, 1.357, 3.684, and 10 seconds.
|
|
252
|
+
With a caller's 1-second minimum and 30-second budget, they become
|
|
253
|
+
approximately 1, 3.107, 9.655, and 30 seconds. With one retry, only the initial
|
|
254
|
+
base interval is used.
|
|
255
|
+
|
|
256
|
+
`max_retries` defaults to 4: at most four retry rounds after the initial
|
|
257
|
+
immediate check, or five rounds total. If the last allowed round succeeds,
|
|
258
|
+
the protected block still runs. If it fails, the throttler raises
|
|
259
|
+
`Freno::Throttler::RetryLimitExceeded`, even when wait budget remains.
|
|
260
|
+
Set `max_retries: 0` to check once without sleeping. The limit must be a
|
|
261
|
+
non-negative integer.
|
|
262
|
+
|
|
263
|
+
For every retry, jitter samples a fresh delay from the interval between
|
|
264
|
+
50% and 150% of that retry's base, restricted to the configured minimum and
|
|
265
|
+
maximum. Default delays therefore never fall below 0.5 seconds or exceed
|
|
266
|
+
10 seconds; the 1/30 override stays between 1 and 30 seconds. Sampling within
|
|
267
|
+
the restricted interval avoids grouping out-of-range draws at the bounds.
|
|
268
|
+
The first check is still immediate.
|
|
269
|
+
|
|
270
|
+
Set `backoff: false` for constant base intervals with jitter, or `jitter: false`
|
|
271
|
+
for backoff without randomization. Disable both to retain fixed retry delays:
|
|
272
|
+
|
|
273
|
+
```ruby
|
|
274
|
+
throttler = Freno::Throttler.new(client: client, app: :my_app, backoff: false, jitter: false)
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
The retry-count and total-wait limits still apply when backoff and jitter
|
|
278
|
+
are disabled.
|
|
237
279
|
|
|
238
280
|
If replication lags badly, you can control until when you want to keep sleeping
|
|
239
|
-
and retrying the check by setting `max_wait_seconds`.
|
|
281
|
+
and retrying the check by setting `max_wait_seconds`. Each sampled delay counts
|
|
282
|
+
toward that budget and the cumulative `waited` instrumentation. If the next delay
|
|
283
|
+
would exceed the remaining budget, the throttler raises
|
|
284
|
+
`Freno::Throttler::WaitedTooLong` without sleeping again. As before, this budget
|
|
285
|
+
covers retry sleeps, not time spent making HTTP requests.
|
|
286
|
+
|
|
287
|
+
Backoff, retry count, and wait budget reset for each `throttle` call.
|
|
288
|
+
The upper bound is not a guaranteed final sleep. Earlier waits consume the
|
|
289
|
+
total budget, so a final delay equal to that budget cannot fit after earlier
|
|
290
|
+
positive waits. For example, with jitter disabled the default first three
|
|
291
|
+
delays total about 5.54 seconds; the next 10-second delay does not fit.
|
|
292
|
+
Jitter can change how many retries fit, but never allows more than
|
|
293
|
+
`max_retries`. Checking stops immediately if Freno allows the operation.
|
|
294
|
+
|
|
295
|
+
When either limit stops polling, the protected block does not run. Neither
|
|
296
|
+
`RetryLimitExceeded` nor `WaitedTooLong` itself closes HTTP or database
|
|
297
|
+
connections. Both inherit from `Freno::Throttler::Error`. A caller that catches
|
|
298
|
+
the error and retries can start another cycle with fresh limits.
|
|
299
|
+
|
|
300
|
+
Both limits emit `throttler.waited_too_long`, preserving existing terminal
|
|
301
|
+
failure instrumentation. Its payload includes `reason: :retry_limit` or
|
|
302
|
+
`reason: :wait_budget`, the completed `retries`, and `max_retries`, alongside
|
|
303
|
+
the cumulative `waited` and total budget `max`. Existing timeout counters
|
|
304
|
+
that consume this event will also count retry-limit failures.
|
|
305
|
+
|
|
306
|
+
Neither backoff nor jitter retries transport errors, changes Freno's admission
|
|
307
|
+
decisions, or limits concurrent writes. Transport errors still raise
|
|
308
|
+
`ClientError` immediately; separate transport and application retry loops are
|
|
309
|
+
unaffected. Applications still need shared rate and concurrency limits to
|
|
310
|
+
control how much work resumes.
|
|
311
|
+
|
|
312
|
+
The retry cap counts polling rounds, not individual HTTP requests or TCP
|
|
313
|
+
connections. A round can check multiple stores. It does not cap adapter-level
|
|
314
|
+
transport retries or retries made by an application or job framework.
|
|
240
315
|
|
|
241
316
|
#### Instrumenting the throttler
|
|
242
317
|
|
data/freno-client.gemspec
CHANGED
|
@@ -3,26 +3,31 @@
|
|
|
3
3
|
require_relative "lib/freno/client/version"
|
|
4
4
|
|
|
5
5
|
Gem::Specification.new do |spec|
|
|
6
|
-
spec.name
|
|
6
|
+
spec.name = "freno-client"
|
|
7
7
|
spec.version = Freno::Client::VERSION
|
|
8
|
-
spec.
|
|
9
|
-
spec.email = "opensource+freno-client@github.com"
|
|
10
|
-
|
|
11
|
-
spec.summary = "A library for interacting with Freno, the throttler service"
|
|
8
|
+
spec.summary = "A library for interacting with Freno, the throttler service"
|
|
12
9
|
spec.description = <<~DESC.gsub(/\s+/, " ")
|
|
13
10
|
freno-client is a Ruby library that interacts with Freno using HTTP.
|
|
14
11
|
Freno is a throttling service and its source code is available at
|
|
15
12
|
https://github.com/github/freno
|
|
16
13
|
DESC
|
|
17
14
|
|
|
15
|
+
spec.author = "GitHub"
|
|
16
|
+
spec.email = "opensource+freno-client@github.com"
|
|
17
|
+
spec.license = "MIT"
|
|
18
18
|
spec.homepage = "https://github.com/github/freno-client"
|
|
19
|
-
spec.license = "MIT"
|
|
20
|
-
|
|
21
|
-
spec.required_ruby_version = ">= 2.7.0"
|
|
22
19
|
|
|
23
|
-
spec.
|
|
20
|
+
spec.metadata = {
|
|
21
|
+
"allowed_push_host" => "https://rubygems.org",
|
|
22
|
+
"bug_tracker_uri" => "https://github.com/github/freno-client/issues",
|
|
23
|
+
"homepage_uri" => "https://github.com/github/freno-client",
|
|
24
|
+
"rubygems_mfa_required" => "true",
|
|
25
|
+
"source_code_uri" => "https://github.com/github/freno-client"
|
|
26
|
+
}
|
|
24
27
|
|
|
28
|
+
spec.required_ruby_version = ">= 3.0"
|
|
25
29
|
spec.add_dependency "faraday", "< 3"
|
|
26
30
|
|
|
27
|
-
spec.
|
|
31
|
+
spec.files = Dir.glob(["freno-client.gemspec", "lib/**/*.rb", "LICENSE.txt"])
|
|
32
|
+
spec.extra_rdoc_files = ["README.md"]
|
|
28
33
|
end
|
data/lib/freno/client/errors.rb
CHANGED
|
@@ -5,7 +5,8 @@ module Freno
|
|
|
5
5
|
module Preconditions
|
|
6
6
|
module_function
|
|
7
7
|
|
|
8
|
-
PreconditionNotMet
|
|
8
|
+
class PreconditionNotMet < ArgumentError
|
|
9
|
+
end
|
|
9
10
|
|
|
10
11
|
class Checker
|
|
11
12
|
attr_reader :errors
|
|
@@ -16,9 +17,7 @@ module Freno
|
|
|
16
17
|
|
|
17
18
|
def present(args = {})
|
|
18
19
|
args.each do |arg, value|
|
|
19
|
-
unless value
|
|
20
|
-
errors << "#{arg} should be present"
|
|
21
|
-
end
|
|
20
|
+
errors << "#{arg} should be present" unless value
|
|
22
21
|
end
|
|
23
22
|
end
|
|
24
23
|
|
data/lib/freno/client/version.rb
CHANGED
data/lib/freno/client.rb
CHANGED
|
@@ -15,6 +15,13 @@ module Freno
|
|
|
15
15
|
end
|
|
16
16
|
end
|
|
17
17
|
|
|
18
|
+
# Raised if all allowed retry rounds were rejected.
|
|
19
|
+
class RetryLimitExceeded < Error
|
|
20
|
+
def initialize(max_retries:, waited_seconds:)
|
|
21
|
+
super("Retry limit of #{max_retries} reached after waiting #{waited_seconds} seconds")
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
18
25
|
# Raised if the circuit breaker is open and didn't allow latest request
|
|
19
26
|
class CircuitOpen < Error; end
|
|
20
27
|
|
data/lib/freno/throttler.rb
CHANGED
|
@@ -35,6 +35,7 @@ module Freno
|
|
|
35
35
|
class Throttler
|
|
36
36
|
DEFAULT_WAIT_SECONDS = 0.5
|
|
37
37
|
DEFAULT_MAX_WAIT_SECONDS = 10
|
|
38
|
+
DEFAULT_MAX_RETRIES = 4
|
|
38
39
|
REQUIRED_ARGS = %i[
|
|
39
40
|
client
|
|
40
41
|
app
|
|
@@ -51,7 +52,10 @@ module Freno
|
|
|
51
52
|
:instrumenter,
|
|
52
53
|
:circuit_breaker,
|
|
53
54
|
:wait_seconds,
|
|
54
|
-
:max_wait_seconds
|
|
55
|
+
:max_wait_seconds,
|
|
56
|
+
:jitter,
|
|
57
|
+
:backoff,
|
|
58
|
+
:max_retries
|
|
55
59
|
|
|
56
60
|
# Initializes a new instance of the throttler
|
|
57
61
|
#
|
|
@@ -91,9 +95,17 @@ module Freno
|
|
|
91
95
|
# By default, the circuit breaker is `CircuitBreaker::Noop`, which
|
|
92
96
|
# always allows requests, and does not provide resiliency guarantees.
|
|
93
97
|
#
|
|
94
|
-
# - `:wait_seconds`: A positive float indicating the
|
|
95
|
-
#
|
|
96
|
-
#
|
|
98
|
+
# - `:wait_seconds`: A positive float indicating the base delay before
|
|
99
|
+
# checking again when some of the stores haven't caught up.
|
|
100
|
+
#
|
|
101
|
+
# - `:jitter`: Randomize each delay around its base interval, bounded by
|
|
102
|
+
# `wait_seconds` and `max_wait_seconds`. Defaults to true.
|
|
103
|
+
#
|
|
104
|
+
# - `:backoff`: Grow base intervals geometrically from `wait_seconds` to
|
|
105
|
+
# `max_wait_seconds` across the allowed retry slots. Defaults to true.
|
|
106
|
+
#
|
|
107
|
+
# - `:max_retries`: The maximum retry rounds after the initial check.
|
|
108
|
+
# Defaults to 4. Set 0 to check once without retrying.
|
|
97
109
|
#
|
|
98
110
|
# - `:max_wait_seconds`: A positive float indicating the maxium number of
|
|
99
111
|
# seconds the throttler will wait in total for replicas to catch-up
|
|
@@ -106,7 +118,10 @@ module Freno
|
|
|
106
118
|
instrumenter: Instrumenter::Noop,
|
|
107
119
|
circuit_breaker: CircuitBreaker::Noop,
|
|
108
120
|
wait_seconds: DEFAULT_WAIT_SECONDS,
|
|
109
|
-
max_wait_seconds: DEFAULT_MAX_WAIT_SECONDS
|
|
121
|
+
max_wait_seconds: DEFAULT_MAX_WAIT_SECONDS,
|
|
122
|
+
jitter: true,
|
|
123
|
+
backoff: true,
|
|
124
|
+
max_retries: DEFAULT_MAX_RETRIES
|
|
110
125
|
)
|
|
111
126
|
@client = client
|
|
112
127
|
@app = app
|
|
@@ -115,6 +130,9 @@ module Freno
|
|
|
115
130
|
@circuit_breaker = circuit_breaker
|
|
116
131
|
@wait_seconds = wait_seconds
|
|
117
132
|
@max_wait_seconds = max_wait_seconds
|
|
133
|
+
@jitter = jitter
|
|
134
|
+
@backoff = backoff
|
|
135
|
+
@max_retries = max_retries
|
|
118
136
|
|
|
119
137
|
yield self if block_given?
|
|
120
138
|
|
|
@@ -136,10 +154,14 @@ module Freno
|
|
|
136
154
|
#
|
|
137
155
|
# With that information it asks freno whether all the stores are ok.
|
|
138
156
|
# In case they are, it executes the given block.
|
|
139
|
-
# Otherwise, it waits
|
|
157
|
+
# Otherwise, it waits before trying again, starting at `wait_seconds`
|
|
158
|
+
# and backing off with jitter by default. Both can be disabled independently.
|
|
159
|
+
# The base interval, retry count, and wait budget reset for each call.
|
|
160
|
+
#
|
|
161
|
+
# If all `max_retries` retry rounds fail, it raises `RetryLimitExceeded`.
|
|
140
162
|
#
|
|
141
|
-
#
|
|
142
|
-
# a `WaitedTooLong` error.
|
|
163
|
+
# If the next delay would exceed the remaining `max_wait_seconds` budget,
|
|
164
|
+
# it raises a `WaitedTooLong` error without sleeping.
|
|
143
165
|
#
|
|
144
166
|
# In case there's an underlying Freno error, it raises a `ClientError`
|
|
145
167
|
# error.
|
|
@@ -151,11 +173,9 @@ module Freno
|
|
|
151
173
|
#
|
|
152
174
|
# - "throttler.called" each time this method is called
|
|
153
175
|
# - "throttler.succeeded" when the stores were ok, before yielding the block
|
|
154
|
-
# - "throttler.waited"
|
|
155
|
-
#
|
|
156
|
-
#
|
|
157
|
-
# thottler already waited at least `max_wait_seconds`, right before
|
|
158
|
-
# raising `WaitedTooLong`
|
|
176
|
+
# - "throttler.waited" after sleeping, with the cumulative sampled delays
|
|
177
|
+
# - "throttler.waited_too_long" when the retry limit or wait budget stops
|
|
178
|
+
# polling. The `reason` is `:retry_limit` or `:wait_budget`.
|
|
159
179
|
# - "throttler.freno_errored" when there was an error with freno, before
|
|
160
180
|
# raising `ClientError`.
|
|
161
181
|
# - "throttler.circuit_open" when the circuit breaker does not allow the
|
|
@@ -165,6 +185,7 @@ module Freno
|
|
|
165
185
|
store_names = mapper.call(context)
|
|
166
186
|
instrument(:called, store_names: store_names)
|
|
167
187
|
waited = 0
|
|
188
|
+
retries = 0
|
|
168
189
|
|
|
169
190
|
while true
|
|
170
191
|
unless circuit_breaker.allow_request?
|
|
@@ -178,14 +199,24 @@ module Freno
|
|
|
178
199
|
break
|
|
179
200
|
end
|
|
180
201
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
202
|
+
if retries >= max_retries
|
|
203
|
+
instrument(:waited_too_long, store_names: store_names, waited: waited, max: max_wait_seconds,
|
|
204
|
+
reason: :retry_limit, retries: retries, max_retries: max_retries)
|
|
205
|
+
circuit_breaker.failure
|
|
206
|
+
raise RetryLimitExceeded.new(max_retries: max_retries, waited_seconds: waited)
|
|
207
|
+
end
|
|
184
208
|
|
|
185
|
-
|
|
186
|
-
|
|
209
|
+
retry_wait_seconds = next_wait_seconds(retries)
|
|
210
|
+
if waited + retry_wait_seconds > max_wait_seconds
|
|
211
|
+
instrument(:waited_too_long, store_names: store_names, waited: waited, max: max_wait_seconds,
|
|
212
|
+
reason: :wait_budget, retries: retries, max_retries: max_retries)
|
|
187
213
|
circuit_breaker.failure
|
|
188
214
|
raise WaitedTooLong.new(waited_seconds: waited, max_wait_seconds: max_wait_seconds)
|
|
215
|
+
else
|
|
216
|
+
wait(retry_wait_seconds)
|
|
217
|
+
waited += retry_wait_seconds
|
|
218
|
+
retries += 1
|
|
219
|
+
instrument(:waited, store_names: store_names, waited: waited, max: max_wait_seconds)
|
|
189
220
|
end
|
|
190
221
|
end
|
|
191
222
|
|
|
@@ -201,9 +232,16 @@ module Freno
|
|
|
201
232
|
errors << "#{argument} must be provided" unless send(argument)
|
|
202
233
|
end
|
|
203
234
|
|
|
204
|
-
|
|
235
|
+
valid_wait = positive_finite_number?(wait_seconds)
|
|
236
|
+
valid_max = positive_finite_number?(max_wait_seconds)
|
|
237
|
+
errors << "wait_seconds must be a positive finite number" unless valid_wait
|
|
238
|
+
errors << "max_wait_seconds must be a positive finite number" unless valid_max
|
|
239
|
+
if valid_wait && valid_max && max_wait_seconds <= wait_seconds
|
|
205
240
|
errors << "max_wait_seconds (#{max_wait_seconds}) has to be greather than wait_seconds (#{wait_seconds})"
|
|
206
241
|
end
|
|
242
|
+
errors << "jitter must be true or false" unless [true, false].include?(jitter)
|
|
243
|
+
errors << "backoff must be true or false" unless [true, false].include?(backoff)
|
|
244
|
+
errors << "max_retries must be a non-negative integer" unless max_retries.is_a?(Integer) && max_retries >= 0
|
|
207
245
|
|
|
208
246
|
raise ArgumentError, errors.join("\n") if errors.any?
|
|
209
247
|
end
|
|
@@ -218,8 +256,30 @@ module Freno
|
|
|
218
256
|
raise ClientError, error
|
|
219
257
|
end
|
|
220
258
|
|
|
221
|
-
def
|
|
222
|
-
|
|
259
|
+
def positive_finite_number?(value)
|
|
260
|
+
value.is_a?(Numeric) && value.real? && value.finite? && value.positive?
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
def base_wait_seconds(retries)
|
|
264
|
+
return wait_seconds unless backoff && max_retries > 1 && retries.positive?
|
|
265
|
+
return max_wait_seconds if retries == max_retries - 1
|
|
266
|
+
|
|
267
|
+
progress = retries.fdiv(max_retries - 1)
|
|
268
|
+
interval = Math.exp(((1 - progress) * Math.log(wait_seconds)) + (progress * Math.log(max_wait_seconds)))
|
|
269
|
+
interval.clamp(wait_seconds, max_wait_seconds)
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
def next_wait_seconds(retries)
|
|
273
|
+
base = base_wait_seconds(retries)
|
|
274
|
+
return base unless jitter
|
|
275
|
+
|
|
276
|
+
minimum = [wait_seconds, base * 0.5].max
|
|
277
|
+
maximum = [max_wait_seconds, base * 1.5].min
|
|
278
|
+
minimum + (rand * (maximum - minimum))
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
def wait(seconds)
|
|
282
|
+
sleep seconds
|
|
223
283
|
end
|
|
224
284
|
|
|
225
285
|
def instrument(event_name, payload = {}, &block)
|
metadata
CHANGED
|
@@ -1,85 +1,80 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: freno-client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.10.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
- GitHub
|
|
8
|
-
autorequire:
|
|
7
|
+
- GitHub
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
|
-
- !ruby/object:Gem::Dependency
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: faraday
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
-
|
|
17
|
+
- "<"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: "3"
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
-
|
|
25
|
+
- "<"
|
|
26
|
+
- !ruby/object:Gem::Version
|
|
27
|
+
version: "3"
|
|
28
|
+
description: "freno-client is a Ruby library that interacts with Freno using HTTP. Freno is a throttling service and its source code is available at https://github.com/github/freno "
|
|
29
29
|
email: opensource+freno-client@github.com
|
|
30
30
|
executables: []
|
|
31
31
|
extensions: []
|
|
32
|
-
extra_rdoc_files:
|
|
32
|
+
extra_rdoc_files:
|
|
33
|
+
- README.md
|
|
33
34
|
files:
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
- freno
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
- lib/freno/
|
|
48
|
-
- lib/freno/
|
|
49
|
-
- lib/freno/
|
|
50
|
-
- lib/freno/
|
|
51
|
-
|
|
52
|
-
- lib/freno/client/requests/check_read.rb
|
|
53
|
-
- lib/freno/client/requests/replication_delay.rb
|
|
54
|
-
- lib/freno/client/result.rb
|
|
55
|
-
- lib/freno/client/version.rb
|
|
56
|
-
- lib/freno/throttler.rb
|
|
57
|
-
- lib/freno/throttler/circuit_breaker.rb
|
|
58
|
-
- lib/freno/throttler/errors.rb
|
|
59
|
-
- lib/freno/throttler/instrumenter.rb
|
|
60
|
-
- lib/freno/throttler/mapper.rb
|
|
61
|
-
homepage: https://github.com/github/freno-client
|
|
35
|
+
- LICENSE.txt
|
|
36
|
+
- README.md
|
|
37
|
+
- freno-client.gemspec
|
|
38
|
+
- lib/freno/client.rb
|
|
39
|
+
- lib/freno/client/errors.rb
|
|
40
|
+
- lib/freno/client/preconditions.rb
|
|
41
|
+
- lib/freno/client/request.rb
|
|
42
|
+
- lib/freno/client/requests/check.rb
|
|
43
|
+
- lib/freno/client/requests/check_read.rb
|
|
44
|
+
- lib/freno/client/requests/replication_delay.rb
|
|
45
|
+
- lib/freno/client/result.rb
|
|
46
|
+
- lib/freno/client/version.rb
|
|
47
|
+
- lib/freno/throttler.rb
|
|
48
|
+
- lib/freno/throttler/circuit_breaker.rb
|
|
49
|
+
- lib/freno/throttler/errors.rb
|
|
50
|
+
- lib/freno/throttler/instrumenter.rb
|
|
51
|
+
- lib/freno/throttler/mapper.rb
|
|
52
|
+
homepage: "https://github.com/github/freno-client"
|
|
62
53
|
licenses:
|
|
63
|
-
- MIT
|
|
54
|
+
- MIT
|
|
64
55
|
metadata:
|
|
65
|
-
|
|
66
|
-
|
|
56
|
+
allowed_push_host: "https://rubygems.org"
|
|
57
|
+
bug_tracker_uri: "https://github.com/github/freno-client/issues"
|
|
58
|
+
homepage_uri: "https://github.com/github/freno-client"
|
|
59
|
+
rubygems_mfa_required: "true"
|
|
60
|
+
source_code_uri: "https://github.com/github/freno-client"
|
|
67
61
|
rdoc_options: []
|
|
68
62
|
require_paths:
|
|
69
|
-
- lib
|
|
63
|
+
- lib
|
|
70
64
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
71
65
|
requirements:
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
66
|
+
-
|
|
67
|
+
- ">="
|
|
68
|
+
- !ruby/object:Gem::Version
|
|
69
|
+
version: "3.0"
|
|
75
70
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
71
|
requirements:
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
72
|
+
-
|
|
73
|
+
- ">="
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: "0"
|
|
80
76
|
requirements: []
|
|
81
|
-
rubygems_version:
|
|
82
|
-
signing_key:
|
|
77
|
+
rubygems_version: 4.1.0
|
|
83
78
|
specification_version: 4
|
|
84
|
-
summary: A library for interacting with Freno, the throttler service
|
|
79
|
+
summary: "A library for interacting with Freno, the throttler service"
|
|
85
80
|
test_files: []
|
data/.github/workflows/ruby.yml
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
name: Ruby
|
|
2
|
-
on:
|
|
3
|
-
push:
|
|
4
|
-
branches:
|
|
5
|
-
- main
|
|
6
|
-
pull_request:
|
|
7
|
-
branches:
|
|
8
|
-
- main
|
|
9
|
-
permissions:
|
|
10
|
-
contents: read
|
|
11
|
-
jobs:
|
|
12
|
-
test:
|
|
13
|
-
runs-on: ubuntu-latest
|
|
14
|
-
strategy:
|
|
15
|
-
matrix:
|
|
16
|
-
ruby-version:
|
|
17
|
-
- '2.7'
|
|
18
|
-
- '3.0'
|
|
19
|
-
- '3.1'
|
|
20
|
-
gemfile-path:
|
|
21
|
-
- Gemfile
|
|
22
|
-
- gemfiles/faraday_0.gemfile
|
|
23
|
-
- gemfiles/faraday_1.gemfile
|
|
24
|
-
- gemfiles/faraday_2.gemfile
|
|
25
|
-
env:
|
|
26
|
-
BUNDLE_GEMFILE: ${{ github.workspace }}/${{ matrix.gemfile-path }}
|
|
27
|
-
steps:
|
|
28
|
-
- uses: actions/checkout@v3
|
|
29
|
-
- name: Set up Ruby
|
|
30
|
-
uses: ruby/setup-ruby@v1
|
|
31
|
-
with:
|
|
32
|
-
ruby-version: ${{ matrix.ruby-version }}
|
|
33
|
-
bundler-cache: true
|
|
34
|
-
- name: Run tests
|
|
35
|
-
run: bundle exec rake
|
data/.gitignore
DELETED
data/.rubocop.yml
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
require:
|
|
2
|
-
- rubocop-minitest
|
|
3
|
-
- rubocop-performance
|
|
4
|
-
- rubocop-rake
|
|
5
|
-
|
|
6
|
-
AllCops:
|
|
7
|
-
NewCops: enable
|
|
8
|
-
TargetRubyVersion: 2.7
|
|
9
|
-
|
|
10
|
-
Layout/MultilineMethodCallIndentation:
|
|
11
|
-
Enabled: true
|
|
12
|
-
EnforcedStyle: indented_relative_to_receiver
|
|
13
|
-
|
|
14
|
-
Metrics:
|
|
15
|
-
Enabled: false
|
|
16
|
-
|
|
17
|
-
Minitest/AssertEmptyLiteral:
|
|
18
|
-
Enabled: false
|
|
19
|
-
Minitest/AssertEqual:
|
|
20
|
-
Enabled: false
|
|
21
|
-
Minitest/AssertPredicate:
|
|
22
|
-
Enabled: false
|
|
23
|
-
Minitest/MultipleAssertions:
|
|
24
|
-
Enabled: false
|
|
25
|
-
Minitest/RefutePredicate:
|
|
26
|
-
Enabled: false
|
|
27
|
-
|
|
28
|
-
Naming/RescuedExceptionsVariableName:
|
|
29
|
-
Enabled: true
|
|
30
|
-
PreferredName: error
|
|
31
|
-
|
|
32
|
-
Style/ClassAndModuleChildren:
|
|
33
|
-
Enabled: true
|
|
34
|
-
Exclude:
|
|
35
|
-
- test/**/*
|
|
36
|
-
Style/Documentation:
|
|
37
|
-
Enabled: false
|
|
38
|
-
Style/IfUnlessModifier:
|
|
39
|
-
Enabled: false
|
|
40
|
-
Style/StringLiterals:
|
|
41
|
-
Enabled: true
|
|
42
|
-
EnforcedStyle: double_quotes
|
|
43
|
-
Style/SymbolArray:
|
|
44
|
-
Enabled: false
|
|
45
|
-
Style/InfiniteLoop:
|
|
46
|
-
Enabled: false
|
|
47
|
-
Style/Next:
|
|
48
|
-
Enabled: false
|
data/CODE_OF_CONDUCT.md
DELETED
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
|
2
|
-
|
|
3
|
-
## Our Pledge
|
|
4
|
-
|
|
5
|
-
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
-
contributors and maintainers pledge to making participation in our project and
|
|
7
|
-
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
-
size, disability, ethnicity, gender identity and expression, level of experience,
|
|
9
|
-
nationality, personal appearance, race, religion, or sexual identity and
|
|
10
|
-
orientation.
|
|
11
|
-
|
|
12
|
-
## Our Standards
|
|
13
|
-
|
|
14
|
-
Examples of behavior that contributes to creating a positive environment
|
|
15
|
-
include:
|
|
16
|
-
|
|
17
|
-
* Using welcoming and inclusive language
|
|
18
|
-
* Being respectful of differing viewpoints and experiences
|
|
19
|
-
* Gracefully accepting constructive criticism
|
|
20
|
-
* Focusing on what is best for the community
|
|
21
|
-
* Showing empathy towards other community members
|
|
22
|
-
|
|
23
|
-
Examples of unacceptable behavior by participants include:
|
|
24
|
-
|
|
25
|
-
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
-
advances
|
|
27
|
-
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
-
* Public or private harassment
|
|
29
|
-
* Publishing others' private information, such as a physical or electronic
|
|
30
|
-
address, without explicit permission
|
|
31
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
-
professional setting
|
|
33
|
-
|
|
34
|
-
## Our Responsibilities
|
|
35
|
-
|
|
36
|
-
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
-
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
-
response to any instances of unacceptable behavior.
|
|
39
|
-
|
|
40
|
-
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
-
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
-
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
-
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
-
threatening, offensive, or harmful.
|
|
45
|
-
|
|
46
|
-
## Scope
|
|
47
|
-
|
|
48
|
-
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
-
when an individual is representing the project or its community. Examples of
|
|
50
|
-
representing a project or community include using an official project e-mail
|
|
51
|
-
address, posting via an official social media account, or acting as an appointed
|
|
52
|
-
representative at an online or offline event. Representation of a project may be
|
|
53
|
-
further defined and clarified by project maintainers.
|
|
54
|
-
|
|
55
|
-
## Enforcement
|
|
56
|
-
|
|
57
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
-
reported by contacting the project team at opensource+freno-client@github.com. All
|
|
59
|
-
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
-
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
-
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
-
Further details of specific enforcement policies may be posted separately.
|
|
63
|
-
|
|
64
|
-
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
-
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
-
members of the project's leadership.
|
|
67
|
-
|
|
68
|
-
## Attribution
|
|
69
|
-
|
|
70
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
-
available at [http://contributor-covenant.org/version/1/4][version]
|
|
72
|
-
|
|
73
|
-
[homepage]: http://contributor-covenant.org
|
|
74
|
-
[version]: http://contributor-covenant.org/version/1/4/
|
data/CONTRIBUTING.md
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
## Contributing
|
|
2
|
-
|
|
3
|
-
[fork]: https://github.com/github/freno-client/fork
|
|
4
|
-
[pr]: https://github.com/github/freno-client/compare
|
|
5
|
-
[style]: https://github.com/styleguide/ruby
|
|
6
|
-
[code-of-conduct]: CODE_OF_CONDUCT.md
|
|
7
|
-
|
|
8
|
-
Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great.
|
|
9
|
-
|
|
10
|
-
Please note that this project is released with a [Contributor Code of Conduct][code-of-conduct]. By participating in this project you agree to abide by its terms.
|
|
11
|
-
|
|
12
|
-
## Submitting a pull request
|
|
13
|
-
|
|
14
|
-
0. [Fork][fork] and clone the freno-client repository
|
|
15
|
-
0. Configure and install the dependencies: `bin/setup`
|
|
16
|
-
0. Make sure the tests pass on your machine: `bin/test`
|
|
17
|
-
0. Create a new branch: `git checkout -b my-branch-name`
|
|
18
|
-
0. Make your change, add tests, and make sure the tests still pass
|
|
19
|
-
0. Push to your fork and [submit a pull request][pr]
|
|
20
|
-
0. Pat your self on the back and wait for your pull request to be reviewed and merged.
|
|
21
|
-
|
|
22
|
-
Here are a few things you can do that will increase the likelihood of your pull request being accepted:
|
|
23
|
-
|
|
24
|
-
- Write tests.
|
|
25
|
-
- Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests.
|
|
26
|
-
- Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
|
|
27
|
-
|
|
28
|
-
## Resources
|
|
29
|
-
|
|
30
|
-
- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/)
|
|
31
|
-
- [Using Pull Requests](https://help.github.com/articles/about-pull-requests/)
|
|
32
|
-
- [GitHub Help](https://help.github.com)
|
data/Gemfile
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
source "https://rubygems.org"
|
|
4
|
-
|
|
5
|
-
gemspec
|
|
6
|
-
|
|
7
|
-
group :development do
|
|
8
|
-
gem "rake"
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
group :test do
|
|
12
|
-
gem "minitest", ">= 5"
|
|
13
|
-
gem "mocha"
|
|
14
|
-
gem "rubocop", "~> 1.37", require: false
|
|
15
|
-
gem "rubocop-minitest", require: false
|
|
16
|
-
gem "rubocop-performance", require: false
|
|
17
|
-
gem "rubocop-rake", require: false
|
|
18
|
-
end
|
data/Rakefile
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "bundler/gem_tasks"
|
|
4
|
-
require "rake/testtask"
|
|
5
|
-
require "rubocop/rake_task"
|
|
6
|
-
|
|
7
|
-
Rake::TestTask.new(:test) do |t|
|
|
8
|
-
t.libs << "test"
|
|
9
|
-
t.libs << "lib"
|
|
10
|
-
t.test_files = FileList["test/**/*_test.rb"]
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
RuboCop::RakeTask.new(:rubocop)
|
|
14
|
-
|
|
15
|
-
task default: [:test, :rubocop]
|
data/gemfiles/faraday_0.gemfile
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
source "https://rubygems.org"
|
|
4
|
-
|
|
5
|
-
gemspec path: ".."
|
|
6
|
-
|
|
7
|
-
gem "faraday", "~> 0.0"
|
|
8
|
-
|
|
9
|
-
# Content below copied from Gemfile
|
|
10
|
-
|
|
11
|
-
group :development do
|
|
12
|
-
gem "rake"
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
group :test do
|
|
16
|
-
gem "minitest", ">= 5"
|
|
17
|
-
gem "mocha"
|
|
18
|
-
gem "rubocop", "~> 1.37", require: false
|
|
19
|
-
gem "rubocop-minitest", require: false
|
|
20
|
-
gem "rubocop-performance", require: false
|
|
21
|
-
gem "rubocop-rake", require: false
|
|
22
|
-
end
|
data/gemfiles/faraday_1.gemfile
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
source "https://rubygems.org"
|
|
4
|
-
|
|
5
|
-
gemspec path: ".."
|
|
6
|
-
|
|
7
|
-
gem "faraday", "~> 1.0"
|
|
8
|
-
|
|
9
|
-
# Content below copied from Gemfile
|
|
10
|
-
|
|
11
|
-
group :development do
|
|
12
|
-
gem "rake"
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
group :test do
|
|
16
|
-
gem "minitest", ">= 5"
|
|
17
|
-
gem "mocha"
|
|
18
|
-
gem "rubocop", "~> 1.37", require: false
|
|
19
|
-
gem "rubocop-minitest", require: false
|
|
20
|
-
gem "rubocop-performance", require: false
|
|
21
|
-
gem "rubocop-rake", require: false
|
|
22
|
-
end
|
data/gemfiles/faraday_2.gemfile
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
source "https://rubygems.org"
|
|
4
|
-
|
|
5
|
-
gemspec path: ".."
|
|
6
|
-
|
|
7
|
-
gem "faraday", "~> 2.0"
|
|
8
|
-
|
|
9
|
-
# Content below copied from Gemfile
|
|
10
|
-
|
|
11
|
-
group :development do
|
|
12
|
-
gem "rake"
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
group :test do
|
|
16
|
-
gem "minitest", ">= 5"
|
|
17
|
-
gem "mocha"
|
|
18
|
-
gem "rubocop", "~> 1.37", require: false
|
|
19
|
-
gem "rubocop-minitest", require: false
|
|
20
|
-
gem "rubocop-performance", require: false
|
|
21
|
-
gem "rubocop-rake", require: false
|
|
22
|
-
end
|