flipper 1.0.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (142) hide show
  1. checksums.yaml +4 -4
  2. data/.github/FUNDING.yml +1 -0
  3. data/.github/workflows/ci.yml +7 -3
  4. data/.github/workflows/examples.yml +27 -5
  5. data/Changelog.md +326 -272
  6. data/Gemfile +4 -4
  7. data/README.md +13 -11
  8. data/benchmark/typecast_ips.rb +8 -0
  9. data/docs/images/flipper_cloud.png +0 -0
  10. data/examples/cloud/backoff_policy.rb +13 -0
  11. data/examples/cloud/cloud_setup.rb +16 -0
  12. data/examples/cloud/forked.rb +7 -2
  13. data/examples/cloud/threaded.rb +15 -18
  14. data/examples/expressions.rb +213 -0
  15. data/examples/strict.rb +18 -0
  16. data/flipper.gemspec +1 -2
  17. data/lib/flipper/actor.rb +6 -3
  18. data/lib/flipper/adapter.rb +10 -0
  19. data/lib/flipper/adapter_builder.rb +44 -0
  20. data/lib/flipper/adapters/dual_write.rb +1 -3
  21. data/lib/flipper/adapters/failover.rb +0 -4
  22. data/lib/flipper/adapters/failsafe.rb +0 -4
  23. data/lib/flipper/adapters/http/client.rb +26 -7
  24. data/lib/flipper/adapters/http/error.rb +1 -1
  25. data/lib/flipper/adapters/http.rb +18 -13
  26. data/lib/flipper/adapters/instrumented.rb +0 -4
  27. data/lib/flipper/adapters/memoizable.rb +14 -19
  28. data/lib/flipper/adapters/memory.rb +4 -6
  29. data/lib/flipper/adapters/operation_logger.rb +0 -4
  30. data/lib/flipper/adapters/poll.rb +1 -3
  31. data/lib/flipper/adapters/pstore.rb +17 -11
  32. data/lib/flipper/adapters/read_only.rb +4 -4
  33. data/lib/flipper/adapters/strict.rb +47 -0
  34. data/lib/flipper/adapters/sync/feature_synchronizer.rb +10 -1
  35. data/lib/flipper/adapters/sync.rb +0 -4
  36. data/lib/flipper/cloud/configuration.rb +121 -52
  37. data/lib/flipper/cloud/telemetry/backoff_policy.rb +93 -0
  38. data/lib/flipper/cloud/telemetry/instrumenter.rb +26 -0
  39. data/lib/flipper/cloud/telemetry/metric.rb +39 -0
  40. data/lib/flipper/cloud/telemetry/metric_storage.rb +30 -0
  41. data/lib/flipper/cloud/telemetry/submitter.rb +98 -0
  42. data/lib/flipper/cloud/telemetry.rb +183 -0
  43. data/lib/flipper/configuration.rb +25 -4
  44. data/lib/flipper/dsl.rb +51 -0
  45. data/lib/flipper/engine.rb +27 -3
  46. data/lib/flipper/exporters/json/export.rb +1 -1
  47. data/lib/flipper/exporters/json/v1.rb +1 -1
  48. data/lib/flipper/expression/builder.rb +73 -0
  49. data/lib/flipper/expression/constant.rb +25 -0
  50. data/lib/flipper/expression.rb +71 -0
  51. data/lib/flipper/expressions/all.rb +11 -0
  52. data/lib/flipper/expressions/any.rb +9 -0
  53. data/lib/flipper/expressions/boolean.rb +9 -0
  54. data/lib/flipper/expressions/comparable.rb +13 -0
  55. data/lib/flipper/expressions/duration.rb +28 -0
  56. data/lib/flipper/expressions/equal.rb +9 -0
  57. data/lib/flipper/expressions/greater_than.rb +9 -0
  58. data/lib/flipper/expressions/greater_than_or_equal_to.rb +9 -0
  59. data/lib/flipper/expressions/less_than.rb +9 -0
  60. data/lib/flipper/expressions/less_than_or_equal_to.rb +9 -0
  61. data/lib/flipper/expressions/not_equal.rb +9 -0
  62. data/lib/flipper/expressions/now.rb +9 -0
  63. data/lib/flipper/expressions/number.rb +9 -0
  64. data/lib/flipper/expressions/percentage.rb +9 -0
  65. data/lib/flipper/expressions/percentage_of_actors.rb +12 -0
  66. data/lib/flipper/expressions/property.rb +9 -0
  67. data/lib/flipper/expressions/random.rb +9 -0
  68. data/lib/flipper/expressions/string.rb +9 -0
  69. data/lib/flipper/expressions/time.rb +9 -0
  70. data/lib/flipper/feature.rb +55 -0
  71. data/lib/flipper/gate.rb +1 -0
  72. data/lib/flipper/gate_values.rb +5 -2
  73. data/lib/flipper/gates/expression.rb +75 -0
  74. data/lib/flipper/instrumentation/statsd_subscriber.rb +2 -4
  75. data/lib/flipper/middleware/memoizer.rb +29 -13
  76. data/lib/flipper/model/active_record.rb +23 -0
  77. data/lib/flipper/poller.rb +1 -1
  78. data/lib/flipper/serializers/gzip.rb +24 -0
  79. data/lib/flipper/serializers/json.rb +19 -0
  80. data/lib/flipper/spec/shared_adapter_specs.rb +29 -11
  81. data/lib/flipper/test/shared_adapter_test.rb +24 -5
  82. data/lib/flipper/typecast.rb +34 -6
  83. data/lib/flipper/types/percentage.rb +1 -1
  84. data/lib/flipper/version.rb +1 -1
  85. data/lib/flipper.rb +38 -1
  86. data/spec/flipper/adapter_builder_spec.rb +73 -0
  87. data/spec/flipper/adapter_spec.rb +1 -0
  88. data/spec/flipper/adapters/http_spec.rb +39 -5
  89. data/spec/flipper/adapters/memoizable_spec.rb +15 -15
  90. data/spec/flipper/adapters/read_only_spec.rb +26 -11
  91. data/spec/flipper/adapters/strict_spec.rb +62 -0
  92. data/spec/flipper/adapters/sync/feature_synchronizer_spec.rb +27 -0
  93. data/spec/flipper/cloud/configuration_spec.rb +6 -23
  94. data/spec/flipper/cloud/telemetry/backoff_policy_spec.rb +108 -0
  95. data/spec/flipper/cloud/telemetry/metric_spec.rb +87 -0
  96. data/spec/flipper/cloud/telemetry/metric_storage_spec.rb +58 -0
  97. data/spec/flipper/cloud/telemetry/submitter_spec.rb +145 -0
  98. data/spec/flipper/cloud/telemetry_spec.rb +156 -0
  99. data/spec/flipper/cloud_spec.rb +12 -12
  100. data/spec/flipper/configuration_spec.rb +17 -0
  101. data/spec/flipper/dsl_spec.rb +39 -0
  102. data/spec/flipper/engine_spec.rb +108 -7
  103. data/spec/flipper/exporters/json/v1_spec.rb +3 -3
  104. data/spec/flipper/expression/builder_spec.rb +248 -0
  105. data/spec/flipper/expression_spec.rb +188 -0
  106. data/spec/flipper/expressions/all_spec.rb +15 -0
  107. data/spec/flipper/expressions/any_spec.rb +15 -0
  108. data/spec/flipper/expressions/boolean_spec.rb +15 -0
  109. data/spec/flipper/expressions/duration_spec.rb +43 -0
  110. data/spec/flipper/expressions/equal_spec.rb +24 -0
  111. data/spec/flipper/expressions/greater_than_or_equal_to_spec.rb +28 -0
  112. data/spec/flipper/expressions/greater_than_spec.rb +28 -0
  113. data/spec/flipper/expressions/less_than_or_equal_to_spec.rb +28 -0
  114. data/spec/flipper/expressions/less_than_spec.rb +32 -0
  115. data/spec/flipper/expressions/not_equal_spec.rb +15 -0
  116. data/spec/flipper/expressions/now_spec.rb +11 -0
  117. data/spec/flipper/expressions/number_spec.rb +21 -0
  118. data/spec/flipper/expressions/percentage_of_actors_spec.rb +20 -0
  119. data/spec/flipper/expressions/percentage_spec.rb +15 -0
  120. data/spec/flipper/expressions/property_spec.rb +13 -0
  121. data/spec/flipper/expressions/random_spec.rb +9 -0
  122. data/spec/flipper/expressions/string_spec.rb +11 -0
  123. data/spec/flipper/expressions/time_spec.rb +13 -0
  124. data/spec/flipper/feature_spec.rb +360 -1
  125. data/spec/flipper/gate_values_spec.rb +2 -2
  126. data/spec/flipper/gates/expression_spec.rb +108 -0
  127. data/spec/flipper/identifier_spec.rb +4 -5
  128. data/spec/flipper/instrumentation/statsd_subscriber_spec.rb +15 -1
  129. data/spec/flipper/middleware/memoizer_spec.rb +67 -0
  130. data/spec/flipper/model/active_record_spec.rb +61 -0
  131. data/spec/flipper/serializers/gzip_spec.rb +13 -0
  132. data/spec/flipper/serializers/json_spec.rb +13 -0
  133. data/spec/flipper/typecast_spec.rb +43 -7
  134. data/spec/flipper/types/actor_spec.rb +18 -1
  135. data/spec/flipper_integration_spec.rb +102 -4
  136. data/spec/flipper_spec.rb +89 -1
  137. data/spec/spec_helper.rb +5 -0
  138. data/spec/support/actor_names.yml +1 -0
  139. data/spec/support/fake_backoff_policy.rb +15 -0
  140. data/spec/support/spec_helpers.rb +11 -3
  141. metadata +107 -18
  142. data/lib/flipper/cloud/instrumenter.rb +0 -48
data/spec/flipper_spec.rb CHANGED
@@ -64,7 +64,12 @@ RSpec.describe Flipper do
64
64
 
65
65
  describe "delegation to instance" do
66
66
  let(:group) { Flipper::Types::Group.new(:admins) }
67
- let(:actor) { Flipper::Actor.new("1") }
67
+ let(:actor) {
68
+ Flipper::Actor.new("1", {
69
+ "plan" => "basic",
70
+ })
71
+ }
72
+ let(:expression) { Flipper.property(:plan).eq("basic") }
68
73
 
69
74
  before do
70
75
  described_class.configure do |config|
@@ -88,6 +93,37 @@ RSpec.describe Flipper do
88
93
  expect(described_class.instance.enabled?(:search)).to be(false)
89
94
  end
90
95
 
96
+ it 'delegates expression to instance' do
97
+ expect(described_class.expression(:search)).to be(nil)
98
+
99
+ expression = Flipper.property(:plan).eq("basic")
100
+ Flipper.instance.enable_expression :search, expression
101
+
102
+ expect(described_class.expression(:search)).to eq(expression)
103
+ end
104
+
105
+ it 'delegates enable_expression to instance' do
106
+ described_class.enable_expression(:search, expression)
107
+ expect(described_class.instance.enabled?(:search, actor)).to be(true)
108
+ end
109
+
110
+ it 'delegates disable_expression to instance' do
111
+ described_class.disable_expression(:search)
112
+ expect(described_class.instance.enabled?(:search, actor)).to be(false)
113
+ end
114
+
115
+ it 'delegates add_expression to instance' do
116
+ described_class.add_expression(:search, expression)
117
+ expect(described_class.instance.enabled?(:search, actor)).to be(true)
118
+ end
119
+
120
+ it 'delegates remove_expression to instance' do
121
+ described_class.enable_expression(:search, Flipper.any(expression))
122
+ expect(described_class.instance.enabled?(:search, actor)).to be(true)
123
+ described_class.remove_expression(:search, expression)
124
+ expect(described_class.instance.enabled?(:search, actor)).to be(false)
125
+ end
126
+
91
127
  it 'delegates enable_actor to instance' do
92
128
  described_class.enable_actor(:search, actor)
93
129
  expect(described_class.instance.enabled?(:search, actor)).to be(true)
@@ -192,6 +228,10 @@ RSpec.describe Flipper do
192
228
  expect(described_class.memoizing?).to eq(described_class.adapter.memoizing?)
193
229
  end
194
230
 
231
+ it 'delegates read_only? to instance' do
232
+ expect(described_class.read_only?).to eq(described_class.adapter.read_only?)
233
+ end
234
+
195
235
  it 'delegates sync stuff to instance and does nothing' do
196
236
  expect(described_class.sync).to be(nil)
197
237
  expect(described_class.sync_secret).to be(nil)
@@ -326,4 +366,52 @@ RSpec.describe Flipper do
326
366
  expect(described_class.instance_variable_get('@groups_registry')).to eq(registry)
327
367
  end
328
368
  end
369
+
370
+ describe ".constant" do
371
+ it "returns Flipper::Expression::Constant instance" do
372
+ expect(described_class.constant(false)).to eq(Flipper::Expression::Constant.new(false))
373
+ expect(described_class.constant("string")).to eq(Flipper::Expression::Constant.new("string"))
374
+ end
375
+ end
376
+
377
+ describe ".property" do
378
+ it "returns Flipper::Expressions::Property expression" do
379
+ expect(Flipper.property("name")).to eq(Flipper::Expression.build(Property: "name"))
380
+ end
381
+ end
382
+
383
+ describe ".boolean" do
384
+ it "returns Flipper::Expressions::Boolean expression" do
385
+ expect(described_class.boolean(true)).to eq(Flipper::Expression.build(Boolean: true))
386
+ expect(described_class.boolean(false)).to eq(Flipper::Expression.build(Boolean: false))
387
+ end
388
+ end
389
+
390
+ describe ".random" do
391
+ it "returns Flipper::Expressions::Random expression" do
392
+ expect(Flipper.random(100)).to eq(Flipper::Expression.build(Random: 100))
393
+ end
394
+ end
395
+
396
+ describe ".any" do
397
+ let(:age_expression) { Flipper.property(:age).gte(21) }
398
+ let(:plan_expression) { Flipper.property(:plan).eq("basic") }
399
+
400
+ it "returns Flipper::Expressions::Any instance" do
401
+ expect(Flipper.any(age_expression, plan_expression)).to eq(
402
+ Flipper::Expression.build({Any: [age_expression, plan_expression]})
403
+ )
404
+ end
405
+ end
406
+
407
+ describe ".all" do
408
+ let(:age_expression) { Flipper.property(:age).gte(21) }
409
+ let(:plan_expression) { Flipper.property(:plan).eq("basic") }
410
+
411
+ it "returns Flipper::Expressions::All instance" do
412
+ expect(Flipper.all(age_expression, plan_expression)).to eq(
413
+ Flipper::Expression.build({All: [age_expression, plan_expression]})
414
+ )
415
+ end
416
+ end
329
417
  end
data/spec/spec_helper.rb CHANGED
@@ -10,6 +10,7 @@ require 'bundler'
10
10
  Bundler.setup(:default)
11
11
 
12
12
  require 'debug'
13
+ require 'statsd'
13
14
  require 'webmock/rspec'
14
15
  WebMock.disable_net_connect!(allow_localhost: true)
15
16
 
@@ -20,8 +21,12 @@ require 'flipper/ui'
20
21
 
21
22
  Dir[FlipperRoot.join('spec/support/**/*.rb')].sort.each { |f| require f }
22
23
 
24
+ # Disable telemetry logging in specs.
25
+ ENV["FLIPPER_CLOUD_LOGGING_ENABLED"] = "false"
26
+
23
27
  RSpec.configure do |config|
24
28
  config.before(:example) do
29
+ Flipper::Cloud::Telemetry.reset if defined?(Flipper::Cloud::Telemetry) && Flipper::Cloud::Telemetry.respond_to?(:reset)
25
30
  Flipper::Poller.reset if defined?(Flipper::Poller)
26
31
  Flipper.unregister_groups
27
32
  Flipper.configuration = nil
@@ -0,0 +1 @@
1
+ actor_name_1: 'Actor #1'
@@ -0,0 +1,15 @@
1
+ class FakeBackoffPolicy
2
+ def initialize
3
+ @retries = 0
4
+ end
5
+
6
+ attr_reader :retries
7
+
8
+ def next_interval
9
+ @retries += 1
10
+ 0
11
+ end
12
+
13
+ def reset
14
+ end
15
+ end
@@ -42,6 +42,14 @@ module SpecHelpers
42
42
  }
43
43
  end
44
44
 
45
+ def api_positive_percentage_error_response
46
+ {
47
+ 'code' => 3,
48
+ 'message' => 'Percentage must be a positive number less than or equal to 100.',
49
+ 'more_info' => api_error_code_reference_url,
50
+ }
51
+ end
52
+
45
53
  def api_flipper_id_is_missing_response
46
54
  {
47
55
  'code' => 4,
@@ -50,10 +58,10 @@ module SpecHelpers
50
58
  }
51
59
  end
52
60
 
53
- def api_positive_percentage_error_response
61
+ def api_expression_invalid_response
54
62
  {
55
- 'code' => 3,
56
- 'message' => 'Percentage must be a positive number less than or equal to 100.',
63
+ 'code' => 7,
64
+ 'message' => 'The provided expression was not valid.',
57
65
  'more_info' => api_error_code_reference_url,
58
66
  }
59
67
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flipper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Nunemaker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-08-23 00:00:00.000000000 Z
11
+ date: 2023-12-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - "<"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2'
27
- - !ruby/object:Gem::Dependency
28
- name: brow
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: 0.4.1
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: 0.4.1
41
27
  description:
42
28
  email: support@flippercloud.io
43
29
  executables: []
@@ -45,6 +31,7 @@ extensions: []
45
31
  extra_rdoc_files: []
46
32
  files:
47
33
  - ".codeclimate.yml"
34
+ - ".github/FUNDING.yml"
48
35
  - ".github/dependabot.yml"
49
36
  - ".github/workflows/ci.yml"
50
37
  - ".github/workflows/examples.yml"
@@ -71,6 +58,7 @@ files:
71
58
  - examples/api/memoized.ru
72
59
  - examples/basic.rb
73
60
  - examples/cloud/app.ru
61
+ - examples/cloud/backoff_policy.rb
74
62
  - examples/cloud/basic.rb
75
63
  - examples/cloud/cloud_setup.rb
76
64
  - examples/cloud/forked.rb
@@ -79,6 +67,7 @@ files:
79
67
  - examples/configuring_default.rb
80
68
  - examples/dsl.rb
81
69
  - examples/enabled_for_actor.rb
70
+ - examples/expressions.rb
82
71
  - examples/group.rb
83
72
  - examples/group_dynamic_lookup.rb
84
73
  - examples/group_with_members.rb
@@ -92,11 +81,13 @@ files:
92
81
  - examples/percentage_of_actors_enabled_check.rb
93
82
  - examples/percentage_of_actors_group.rb
94
83
  - examples/percentage_of_time.rb
84
+ - examples/strict.rb
95
85
  - flipper-cloud.gemspec
96
86
  - flipper.gemspec
97
87
  - lib/flipper.rb
98
88
  - lib/flipper/actor.rb
99
89
  - lib/flipper/adapter.rb
90
+ - lib/flipper/adapter_builder.rb
100
91
  - lib/flipper/adapters/dual_write.rb
101
92
  - lib/flipper/adapters/failover.rb
102
93
  - lib/flipper/adapters/failsafe.rb
@@ -111,6 +102,7 @@ files:
111
102
  - lib/flipper/adapters/poll/poller.rb
112
103
  - lib/flipper/adapters/pstore.rb
113
104
  - lib/flipper/adapters/read_only.rb
105
+ - lib/flipper/adapters/strict.rb
114
106
  - lib/flipper/adapters/sync.rb
115
107
  - lib/flipper/adapters/sync/feature_synchronizer.rb
116
108
  - lib/flipper/adapters/sync/interval_synchronizer.rb
@@ -118,10 +110,15 @@ files:
118
110
  - lib/flipper/cloud.rb
119
111
  - lib/flipper/cloud/configuration.rb
120
112
  - lib/flipper/cloud/dsl.rb
121
- - lib/flipper/cloud/instrumenter.rb
122
113
  - lib/flipper/cloud/message_verifier.rb
123
114
  - lib/flipper/cloud/middleware.rb
124
115
  - lib/flipper/cloud/routes.rb
116
+ - lib/flipper/cloud/telemetry.rb
117
+ - lib/flipper/cloud/telemetry/backoff_policy.rb
118
+ - lib/flipper/cloud/telemetry/instrumenter.rb
119
+ - lib/flipper/cloud/telemetry/metric.rb
120
+ - lib/flipper/cloud/telemetry/metric_storage.rb
121
+ - lib/flipper/cloud/telemetry/submitter.rb
125
122
  - lib/flipper/configuration.rb
126
123
  - lib/flipper/dsl.rb
127
124
  - lib/flipper/engine.rb
@@ -130,12 +127,35 @@ files:
130
127
  - lib/flipper/exporter.rb
131
128
  - lib/flipper/exporters/json/export.rb
132
129
  - lib/flipper/exporters/json/v1.rb
130
+ - lib/flipper/expression.rb
131
+ - lib/flipper/expression/builder.rb
132
+ - lib/flipper/expression/constant.rb
133
+ - lib/flipper/expressions/all.rb
134
+ - lib/flipper/expressions/any.rb
135
+ - lib/flipper/expressions/boolean.rb
136
+ - lib/flipper/expressions/comparable.rb
137
+ - lib/flipper/expressions/duration.rb
138
+ - lib/flipper/expressions/equal.rb
139
+ - lib/flipper/expressions/greater_than.rb
140
+ - lib/flipper/expressions/greater_than_or_equal_to.rb
141
+ - lib/flipper/expressions/less_than.rb
142
+ - lib/flipper/expressions/less_than_or_equal_to.rb
143
+ - lib/flipper/expressions/not_equal.rb
144
+ - lib/flipper/expressions/now.rb
145
+ - lib/flipper/expressions/number.rb
146
+ - lib/flipper/expressions/percentage.rb
147
+ - lib/flipper/expressions/percentage_of_actors.rb
148
+ - lib/flipper/expressions/property.rb
149
+ - lib/flipper/expressions/random.rb
150
+ - lib/flipper/expressions/string.rb
151
+ - lib/flipper/expressions/time.rb
133
152
  - lib/flipper/feature.rb
134
153
  - lib/flipper/feature_check_context.rb
135
154
  - lib/flipper/gate.rb
136
155
  - lib/flipper/gate_values.rb
137
156
  - lib/flipper/gates/actor.rb
138
157
  - lib/flipper/gates/boolean.rb
158
+ - lib/flipper/gates/expression.rb
139
159
  - lib/flipper/gates/group.rb
140
160
  - lib/flipper/gates/percentage_of_actors.rb
141
161
  - lib/flipper/gates/percentage_of_time.rb
@@ -149,8 +169,11 @@ files:
149
169
  - lib/flipper/metadata.rb
150
170
  - lib/flipper/middleware/memoizer.rb
151
171
  - lib/flipper/middleware/setup_env.rb
172
+ - lib/flipper/model/active_record.rb
152
173
  - lib/flipper/poller.rb
153
174
  - lib/flipper/registry.rb
175
+ - lib/flipper/serializers/gzip.rb
176
+ - lib/flipper/serializers/json.rb
154
177
  - lib/flipper/spec/shared_adapter_specs.rb
155
178
  - lib/flipper/test/shared_adapter_test.rb
156
179
  - lib/flipper/type.rb
@@ -165,6 +188,7 @@ files:
165
188
  - spec/fixtures/feature.json
166
189
  - spec/fixtures/flipper_pstore_1679087600.json
167
190
  - spec/flipper/actor_spec.rb
191
+ - spec/flipper/adapter_builder_spec.rb
168
192
  - spec/flipper/adapter_spec.rb
169
193
  - spec/flipper/adapters/dual_write_spec.rb
170
194
  - spec/flipper/adapters/failover_spec.rb
@@ -176,6 +200,7 @@ files:
176
200
  - spec/flipper/adapters/operation_logger_spec.rb
177
201
  - spec/flipper/adapters/pstore_spec.rb
178
202
  - spec/flipper/adapters/read_only_spec.rb
203
+ - spec/flipper/adapters/strict_spec.rb
179
204
  - spec/flipper/adapters/sync/feature_synchronizer_spec.rb
180
205
  - spec/flipper/adapters/sync/interval_synchronizer_spec.rb
181
206
  - spec/flipper/adapters/sync/synchronizer_spec.rb
@@ -184,6 +209,11 @@ files:
184
209
  - spec/flipper/cloud/dsl_spec.rb
185
210
  - spec/flipper/cloud/message_verifier_spec.rb
186
211
  - spec/flipper/cloud/middleware_spec.rb
212
+ - spec/flipper/cloud/telemetry/backoff_policy_spec.rb
213
+ - spec/flipper/cloud/telemetry/metric_spec.rb
214
+ - spec/flipper/cloud/telemetry/metric_storage_spec.rb
215
+ - spec/flipper/cloud/telemetry/submitter_spec.rb
216
+ - spec/flipper/cloud/telemetry_spec.rb
187
217
  - spec/flipper/cloud_spec.rb
188
218
  - spec/flipper/configuration_spec.rb
189
219
  - spec/flipper/dsl_spec.rb
@@ -192,12 +222,33 @@ files:
192
222
  - spec/flipper/exporter_spec.rb
193
223
  - spec/flipper/exporters/json/export_spec.rb
194
224
  - spec/flipper/exporters/json/v1_spec.rb
225
+ - spec/flipper/expression/builder_spec.rb
226
+ - spec/flipper/expression_spec.rb
227
+ - spec/flipper/expressions/all_spec.rb
228
+ - spec/flipper/expressions/any_spec.rb
229
+ - spec/flipper/expressions/boolean_spec.rb
230
+ - spec/flipper/expressions/duration_spec.rb
231
+ - spec/flipper/expressions/equal_spec.rb
232
+ - spec/flipper/expressions/greater_than_or_equal_to_spec.rb
233
+ - spec/flipper/expressions/greater_than_spec.rb
234
+ - spec/flipper/expressions/less_than_or_equal_to_spec.rb
235
+ - spec/flipper/expressions/less_than_spec.rb
236
+ - spec/flipper/expressions/not_equal_spec.rb
237
+ - spec/flipper/expressions/now_spec.rb
238
+ - spec/flipper/expressions/number_spec.rb
239
+ - spec/flipper/expressions/percentage_of_actors_spec.rb
240
+ - spec/flipper/expressions/percentage_spec.rb
241
+ - spec/flipper/expressions/property_spec.rb
242
+ - spec/flipper/expressions/random_spec.rb
243
+ - spec/flipper/expressions/string_spec.rb
244
+ - spec/flipper/expressions/time_spec.rb
195
245
  - spec/flipper/feature_check_context_spec.rb
196
246
  - spec/flipper/feature_spec.rb
197
247
  - spec/flipper/gate_spec.rb
198
248
  - spec/flipper/gate_values_spec.rb
199
249
  - spec/flipper/gates/actor_spec.rb
200
250
  - spec/flipper/gates/boolean_spec.rb
251
+ - spec/flipper/gates/expression_spec.rb
201
252
  - spec/flipper/gates/group_spec.rb
202
253
  - spec/flipper/gates/percentage_of_actors_spec.rb
203
254
  - spec/flipper/gates/percentage_of_time_spec.rb
@@ -208,8 +259,11 @@ files:
208
259
  - spec/flipper/instrumenters/noop_spec.rb
209
260
  - spec/flipper/middleware/memoizer_spec.rb
210
261
  - spec/flipper/middleware/setup_env_spec.rb
262
+ - spec/flipper/model/active_record_spec.rb
211
263
  - spec/flipper/poller_spec.rb
212
264
  - spec/flipper/registry_spec.rb
265
+ - spec/flipper/serializers/gzip_spec.rb
266
+ - spec/flipper/serializers/json_spec.rb
213
267
  - spec/flipper/typecast_spec.rb
214
268
  - spec/flipper/types/actor_spec.rb
215
269
  - spec/flipper/types/boolean_spec.rb
@@ -220,8 +274,10 @@ files:
220
274
  - spec/flipper_integration_spec.rb
221
275
  - spec/flipper_spec.rb
222
276
  - spec/spec_helper.rb
277
+ - spec/support/actor_names.yml
223
278
  - spec/support/climate_control.rb
224
279
  - spec/support/descriptions.yml
280
+ - spec/support/fake_backoff_policy.rb
225
281
  - spec/support/fake_udp_socket.rb
226
282
  - spec/support/skippable.rb
227
283
  - spec/support/spec_helpers.rb
@@ -256,11 +312,12 @@ requirements: []
256
312
  rubygems_version: 3.4.10
257
313
  signing_key:
258
314
  specification_version: 4
259
- summary: Feature flipper for ANYTHING
315
+ summary: Beautiful, performant feature flags for Ruby.
260
316
  test_files:
261
317
  - spec/fixtures/feature.json
262
318
  - spec/fixtures/flipper_pstore_1679087600.json
263
319
  - spec/flipper/actor_spec.rb
320
+ - spec/flipper/adapter_builder_spec.rb
264
321
  - spec/flipper/adapter_spec.rb
265
322
  - spec/flipper/adapters/dual_write_spec.rb
266
323
  - spec/flipper/adapters/failover_spec.rb
@@ -272,6 +329,7 @@ test_files:
272
329
  - spec/flipper/adapters/operation_logger_spec.rb
273
330
  - spec/flipper/adapters/pstore_spec.rb
274
331
  - spec/flipper/adapters/read_only_spec.rb
332
+ - spec/flipper/adapters/strict_spec.rb
275
333
  - spec/flipper/adapters/sync/feature_synchronizer_spec.rb
276
334
  - spec/flipper/adapters/sync/interval_synchronizer_spec.rb
277
335
  - spec/flipper/adapters/sync/synchronizer_spec.rb
@@ -280,6 +338,11 @@ test_files:
280
338
  - spec/flipper/cloud/dsl_spec.rb
281
339
  - spec/flipper/cloud/message_verifier_spec.rb
282
340
  - spec/flipper/cloud/middleware_spec.rb
341
+ - spec/flipper/cloud/telemetry/backoff_policy_spec.rb
342
+ - spec/flipper/cloud/telemetry/metric_spec.rb
343
+ - spec/flipper/cloud/telemetry/metric_storage_spec.rb
344
+ - spec/flipper/cloud/telemetry/submitter_spec.rb
345
+ - spec/flipper/cloud/telemetry_spec.rb
283
346
  - spec/flipper/cloud_spec.rb
284
347
  - spec/flipper/configuration_spec.rb
285
348
  - spec/flipper/dsl_spec.rb
@@ -288,12 +351,33 @@ test_files:
288
351
  - spec/flipper/exporter_spec.rb
289
352
  - spec/flipper/exporters/json/export_spec.rb
290
353
  - spec/flipper/exporters/json/v1_spec.rb
354
+ - spec/flipper/expression/builder_spec.rb
355
+ - spec/flipper/expression_spec.rb
356
+ - spec/flipper/expressions/all_spec.rb
357
+ - spec/flipper/expressions/any_spec.rb
358
+ - spec/flipper/expressions/boolean_spec.rb
359
+ - spec/flipper/expressions/duration_spec.rb
360
+ - spec/flipper/expressions/equal_spec.rb
361
+ - spec/flipper/expressions/greater_than_or_equal_to_spec.rb
362
+ - spec/flipper/expressions/greater_than_spec.rb
363
+ - spec/flipper/expressions/less_than_or_equal_to_spec.rb
364
+ - spec/flipper/expressions/less_than_spec.rb
365
+ - spec/flipper/expressions/not_equal_spec.rb
366
+ - spec/flipper/expressions/now_spec.rb
367
+ - spec/flipper/expressions/number_spec.rb
368
+ - spec/flipper/expressions/percentage_of_actors_spec.rb
369
+ - spec/flipper/expressions/percentage_spec.rb
370
+ - spec/flipper/expressions/property_spec.rb
371
+ - spec/flipper/expressions/random_spec.rb
372
+ - spec/flipper/expressions/string_spec.rb
373
+ - spec/flipper/expressions/time_spec.rb
291
374
  - spec/flipper/feature_check_context_spec.rb
292
375
  - spec/flipper/feature_spec.rb
293
376
  - spec/flipper/gate_spec.rb
294
377
  - spec/flipper/gate_values_spec.rb
295
378
  - spec/flipper/gates/actor_spec.rb
296
379
  - spec/flipper/gates/boolean_spec.rb
380
+ - spec/flipper/gates/expression_spec.rb
297
381
  - spec/flipper/gates/group_spec.rb
298
382
  - spec/flipper/gates/percentage_of_actors_spec.rb
299
383
  - spec/flipper/gates/percentage_of_time_spec.rb
@@ -304,8 +388,11 @@ test_files:
304
388
  - spec/flipper/instrumenters/noop_spec.rb
305
389
  - spec/flipper/middleware/memoizer_spec.rb
306
390
  - spec/flipper/middleware/setup_env_spec.rb
391
+ - spec/flipper/model/active_record_spec.rb
307
392
  - spec/flipper/poller_spec.rb
308
393
  - spec/flipper/registry_spec.rb
394
+ - spec/flipper/serializers/gzip_spec.rb
395
+ - spec/flipper/serializers/json_spec.rb
309
396
  - spec/flipper/typecast_spec.rb
310
397
  - spec/flipper/types/actor_spec.rb
311
398
  - spec/flipper/types/boolean_spec.rb
@@ -316,8 +403,10 @@ test_files:
316
403
  - spec/flipper_integration_spec.rb
317
404
  - spec/flipper_spec.rb
318
405
  - spec/spec_helper.rb
406
+ - spec/support/actor_names.yml
319
407
  - spec/support/climate_control.rb
320
408
  - spec/support/descriptions.yml
409
+ - spec/support/fake_backoff_policy.rb
321
410
  - spec/support/fake_udp_socket.rb
322
411
  - spec/support/skippable.rb
323
412
  - spec/support/spec_helpers.rb
@@ -1,48 +0,0 @@
1
- require "delegate"
2
- require "flipper/instrumenters/noop"
3
-
4
- module Flipper
5
- module Cloud
6
- class Instrumenter < SimpleDelegator
7
- def initialize(options = {})
8
- @brow = options.fetch(:brow)
9
- @instrumenter = options.fetch(:instrumenter, Instrumenters::Noop)
10
- super @instrumenter
11
- end
12
-
13
- def instrument(name, payload = {}, &block)
14
- result = @instrumenter.instrument(name, payload, &block)
15
- push name, payload
16
- result
17
- end
18
-
19
- private
20
-
21
- def push(name, payload)
22
- return unless name == Flipper::Feature::InstrumentationName
23
- return unless :enabled? == payload[:operation]
24
-
25
- dimensions = {
26
- "feature" => payload[:feature_name].to_s,
27
- "result" => payload[:result].to_s,
28
- }
29
-
30
- if (thing = payload[:thing])
31
- dimensions["flipper_id"] = thing.value.to_s
32
- end
33
-
34
- if (actors = payload[:actors])
35
- dimensions["flipper_ids"] = actors.map { |actor| actor.value.to_s }
36
- end
37
-
38
- event = {
39
- type: "enabled",
40
- dimensions: dimensions,
41
- measures: {},
42
- ts: Time.now.utc,
43
- }
44
- @brow.push event
45
- end
46
- end
47
- end
48
- end