freno-client 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +18 -33
- data/.travis.yml +3 -6
- data/README.md +2 -2
- data/freno-client.gemspec +3 -3
- data/lib/freno/client.rb +18 -0
- data/lib/freno/client/version.rb +1 -1
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: cdef62141f54dfa80e9f96576cbb35b907fe80373befc8b3afda3500c568bc75
|
4
|
+
data.tar.gz: 8a0a8d5305e290776043c094dc1186004c73dda958495e807a51b689e5937b3a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef4ff9cd19b42084aa7f672308b08943ef85a4b1556664dca22c1ac4b75e0a86af4279eafdb28c603edf58fd02386a194fc1221a17d32f15946ffcecc8cca931
|
7
|
+
data.tar.gz: e4084af06baedf9294589fa0690887f1c514acaf76801974358b1c560a18f6d1bf71b8313c3894fa29958fbc6676b07617f957e5e928952bdf85aa2a1c44b719
|
data/.rubocop.yml
CHANGED
@@ -7,21 +7,12 @@ Bundler/DuplicatedGem:
|
|
7
7
|
Bundler/OrderedGems:
|
8
8
|
Enabled: true
|
9
9
|
|
10
|
-
Lint/BlockAlignment:
|
11
|
-
Enabled: true
|
12
|
-
|
13
10
|
Lint/CircularArgumentReference:
|
14
11
|
Enabled: true
|
15
12
|
|
16
|
-
Lint/ConditionPosition:
|
17
|
-
Enabled: true
|
18
|
-
|
19
13
|
Lint/Debugger:
|
20
14
|
Enabled: true
|
21
15
|
|
22
|
-
Lint/DefEndAlignment:
|
23
|
-
Enabled: true
|
24
|
-
|
25
16
|
Lint/DeprecatedClassMethods:
|
26
17
|
Enabled: true
|
27
18
|
|
@@ -46,15 +37,15 @@ Lint/EndInMethod:
|
|
46
37
|
Lint/EmptyInterpolation:
|
47
38
|
Enabled: true
|
48
39
|
|
49
|
-
Lint/EndAlignment:
|
50
|
-
Enabled: false
|
51
|
-
|
52
40
|
Lint/EnsureReturn:
|
53
41
|
Enabled: true
|
54
42
|
|
55
43
|
Lint/FloatOutOfRange:
|
56
44
|
Enabled: true
|
57
45
|
|
46
|
+
Lint/FlipFlop:
|
47
|
+
Enabled: true
|
48
|
+
|
58
49
|
Lint/FormatParameterMismatch:
|
59
50
|
Enabled: true
|
60
51
|
|
@@ -62,12 +53,6 @@ Style/HashSyntax:
|
|
62
53
|
Enabled: true
|
63
54
|
EnforcedStyle: ruby19
|
64
55
|
|
65
|
-
Lint/InvalidCharacterLiteral:
|
66
|
-
Enabled: true
|
67
|
-
|
68
|
-
Lint/LiteralInCondition:
|
69
|
-
Enabled: true
|
70
|
-
|
71
56
|
Lint/LiteralInInterpolation:
|
72
57
|
Enabled: true
|
73
58
|
|
@@ -92,9 +77,6 @@ Lint/StringConversionInInterpolation:
|
|
92
77
|
Lint/UnderscorePrefixedVariableName:
|
93
78
|
Enabled: true
|
94
79
|
|
95
|
-
Lint/UnneededDisable:
|
96
|
-
Enabled: true
|
97
|
-
|
98
80
|
Lint/UnneededSplatExpansion:
|
99
81
|
Enabled: true
|
100
82
|
|
@@ -170,9 +152,6 @@ Performance/EndWith:
|
|
170
152
|
Performance/FlatMap:
|
171
153
|
Enabled: true
|
172
154
|
|
173
|
-
Performance/HashEachMethods:
|
174
|
-
Enabled: true
|
175
|
-
|
176
155
|
Performance/LstripRstrip:
|
177
156
|
Enabled: true
|
178
157
|
|
@@ -213,9 +192,6 @@ Style/BeginBlock:
|
|
213
192
|
Style/BlockComments:
|
214
193
|
Enabled: true
|
215
194
|
|
216
|
-
Layout/BlockEndNewline:
|
217
|
-
Enabled: true
|
218
|
-
|
219
195
|
Style/CaseEquality:
|
220
196
|
Enabled: true
|
221
197
|
|
@@ -234,13 +210,19 @@ Style/DefWithParentheses:
|
|
234
210
|
Style/EndBlock:
|
235
211
|
Enabled: true
|
236
212
|
|
237
|
-
|
213
|
+
Style/For:
|
238
214
|
Enabled: true
|
239
215
|
|
240
|
-
|
216
|
+
Layout/BlockEndNewline:
|
241
217
|
Enabled: true
|
242
218
|
|
243
|
-
|
219
|
+
Layout/ConditionPosition:
|
220
|
+
Enabled: true
|
221
|
+
|
222
|
+
Layout/EndAlignment:
|
223
|
+
Enabled: false
|
224
|
+
|
225
|
+
Layout/EndOfLine:
|
244
226
|
Enabled: true
|
245
227
|
|
246
228
|
Layout/InitialIndentation:
|
@@ -267,6 +249,12 @@ Style/Not:
|
|
267
249
|
Style/OneLineConditional:
|
268
250
|
Enabled: true
|
269
251
|
|
252
|
+
Layout/BlockAlignment:
|
253
|
+
Enabled: true
|
254
|
+
|
255
|
+
Layout/DefEndAlignment:
|
256
|
+
Enabled: true
|
257
|
+
|
270
258
|
Layout/SpaceAfterMethodName:
|
271
259
|
Enabled: true
|
272
260
|
|
@@ -291,9 +279,6 @@ Layout/SpaceAroundEqualsInParameterDefault:
|
|
291
279
|
Layout/SpaceInsideArrayPercentLiteral:
|
292
280
|
Enabled: true
|
293
281
|
|
294
|
-
Layout/SpaceInsideBrackets:
|
295
|
-
Enabled: true
|
296
|
-
|
297
282
|
Layout/SpaceInsideParens:
|
298
283
|
Enabled: true
|
299
284
|
|
data/.travis.yml
CHANGED
@@ -1,16 +1,13 @@
|
|
1
1
|
sudo: false
|
2
2
|
language: ruby
|
3
3
|
rvm:
|
4
|
-
- 2.1
|
5
|
-
- 2.2
|
6
4
|
- 2.3
|
7
5
|
- 2.4
|
6
|
+
- 2.5
|
8
7
|
- ruby-head
|
9
8
|
matrix:
|
10
9
|
allow_failures:
|
11
10
|
- rvm: ruby-head
|
12
|
-
fast_finish: true
|
13
|
-
before_install: gem install bundler -v 1.14.6
|
14
11
|
script:
|
15
|
-
- bundle exec
|
16
|
-
- bundle exec
|
12
|
+
- bundle exec rake
|
13
|
+
- bundle exec rubocop
|
data/README.md
CHANGED
@@ -211,7 +211,7 @@ module Freno
|
|
211
211
|
instrumenter: Instrumenter::Noop,
|
212
212
|
circuit_breaker: CircuitBreaker::Noop,
|
213
213
|
wait_seconds: DEFAULT_WAIT_SECONDS,
|
214
|
-
max_wait_seconds: DEFAULT_MAX_WAIT_SECONDS
|
214
|
+
max_wait_seconds: DEFAULT_MAX_WAIT_SECONDS)
|
215
215
|
|
216
216
|
|
217
217
|
@client = client
|
@@ -278,7 +278,7 @@ An instrumenter is an object that responds to `instrument(event_name, payload =
|
|
278
278
|
|
279
279
|
def extract_tags(payload)
|
280
280
|
cluster_names = payload[:store_names] || []
|
281
|
-
cluster_tags = cluster_names.map{ |cluster_name "cluster:#{cluster_name}" }
|
281
|
+
cluster_tags = cluster_names.map{ |cluster_name| "cluster:#{cluster_name}" }
|
282
282
|
end
|
283
283
|
end
|
284
284
|
```
|
data/freno-client.gemspec
CHANGED
@@ -31,8 +31,8 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.executables = []
|
32
32
|
spec.require_paths = ["lib"]
|
33
33
|
|
34
|
-
spec.add_development_dependency "bundler"
|
35
|
-
spec.add_development_dependency "rake"
|
36
|
-
spec.add_development_dependency "minitest", "~> 5
|
34
|
+
spec.add_development_dependency "bundler"
|
35
|
+
spec.add_development_dependency "rake"
|
36
|
+
spec.add_development_dependency "minitest", "~> 5"
|
37
37
|
spec.add_development_dependency "faraday", "~> 0"
|
38
38
|
end
|
data/lib/freno/client.rb
CHANGED
@@ -5,6 +5,7 @@ require "freno/client/requests/replication_delay"
|
|
5
5
|
|
6
6
|
module Freno
|
7
7
|
class Client
|
8
|
+
class DecorationError < ArgumentError; end
|
8
9
|
|
9
10
|
REQUESTS = {
|
10
11
|
check: Requests::Check,
|
@@ -150,6 +151,8 @@ module Freno
|
|
150
151
|
requests = Array(request)
|
151
152
|
end
|
152
153
|
|
154
|
+
validate!(with)
|
155
|
+
|
153
156
|
requests.each do |request|
|
154
157
|
decorators[request] ||= []
|
155
158
|
decorators[request] += Array(with)
|
@@ -178,5 +181,20 @@ module Freno
|
|
178
181
|
outermost
|
179
182
|
end
|
180
183
|
end
|
184
|
+
|
185
|
+
def validate!(decorators)
|
186
|
+
decorators.each do |decorator|
|
187
|
+
raise DecorationError, "Cannot reuse decorator instance: #{decorator}" if already_registered?(decorator)
|
188
|
+
registered_decorators << decorator
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
def already_registered?(decorator)
|
193
|
+
registered_decorators.include? decorator
|
194
|
+
end
|
195
|
+
|
196
|
+
def registered_decorators
|
197
|
+
@registered_decorators ||= Set.new
|
198
|
+
end
|
181
199
|
end
|
182
200
|
end
|
data/lib/freno/client/version.rb
CHANGED
metadata
CHANGED
@@ -1,57 +1,57 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: freno-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Fernández
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: minitest
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '5
|
47
|
+
version: '5'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '5
|
54
|
+
version: '5'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: faraday
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
128
|
version: '0'
|
129
129
|
requirements: []
|
130
130
|
rubyforge_project:
|
131
|
-
rubygems_version: 2.6
|
131
|
+
rubygems_version: 2.7.6
|
132
132
|
signing_key:
|
133
133
|
specification_version: 4
|
134
134
|
summary: A library for interacting with freno, the throttler service
|