unleash 4.4.4 → 6.4.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.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/pull_request.yml +15 -15
  3. data/.rubocop.yml +5 -1
  4. data/CHANGELOG.md +147 -1
  5. data/README.md +161 -144
  6. data/bin/unleash-client +1 -1
  7. data/echo_client_spec_version.rb +3 -0
  8. data/examples/extending_unleash_with_opentelemetry.rb +63 -0
  9. data/examples/simple.rb +3 -4
  10. data/examples/streaming.rb +50 -0
  11. data/lib/unleash/bootstrap/handler.rb +2 -1
  12. data/lib/unleash/client.rb +47 -26
  13. data/lib/unleash/configuration.rb +48 -7
  14. data/lib/unleash/context.rb +35 -9
  15. data/lib/unleash/metrics_reporter.rb +39 -28
  16. data/lib/unleash/spec_version.rb +3 -0
  17. data/lib/unleash/strategies.rb +14 -61
  18. data/lib/unleash/streaming_client_executor.rb +85 -0
  19. data/lib/unleash/streaming_event_processor.rb +53 -0
  20. data/lib/unleash/toggle_fetcher.rb +29 -58
  21. data/lib/unleash/util/event_source_wrapper.rb +17 -0
  22. data/lib/unleash/util/http.rb +3 -2
  23. data/lib/unleash/variant.rb +11 -3
  24. data/lib/unleash/version.rb +1 -1
  25. data/lib/unleash.rb +2 -1
  26. data/unleash-client.gemspec +8 -4
  27. data/v6_MIGRATION_GUIDE.md +21 -0
  28. metadata +60 -26
  29. data/lib/unleash/activation_strategy.rb +0 -31
  30. data/lib/unleash/constraint.rb +0 -115
  31. data/lib/unleash/feature_toggle.rb +0 -187
  32. data/lib/unleash/metrics.rb +0 -41
  33. data/lib/unleash/strategy/application_hostname.rb +0 -26
  34. data/lib/unleash/strategy/base.rb +0 -16
  35. data/lib/unleash/strategy/default.rb +0 -13
  36. data/lib/unleash/strategy/flexible_rollout.rb +0 -64
  37. data/lib/unleash/strategy/gradual_rollout_random.rb +0 -24
  38. data/lib/unleash/strategy/gradual_rollout_sessionid.rb +0 -21
  39. data/lib/unleash/strategy/gradual_rollout_userid.rb +0 -21
  40. data/lib/unleash/strategy/remote_address.rb +0 -36
  41. data/lib/unleash/strategy/user_with_id.rb +0 -20
  42. data/lib/unleash/strategy/util.rb +0 -16
  43. data/lib/unleash/variant_definition.rb +0 -26
  44. data/lib/unleash/variant_override.rb +0 -44
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f59bcc61a5b2adc71f82f31ee80d02e8957854b86b85147fa33ad1f8bd3ee3ab
4
- data.tar.gz: 691a79a57aba051ab5111d71a038e6c8f2d21ee747ee39fdb6676108fc1ef777
3
+ metadata.gz: a76eb26bedcade3ed88389aa909f7ead99177e336509bc4fd99d85c4703f1405
4
+ data.tar.gz: 43410bf468ac4fd3b56af79a354eb84794c40c67b6c2d96c27bdf26772b1c54d
5
5
  SHA512:
6
- metadata.gz: c6d4c9efc598b2eae5958c7c68c362832988d6ed8cc4f51d47e0ede588b37599c0d104d4a7c08060761564653bdb68d1c6a20dedafc7b6d3bbb22c489ac8c4ec
7
- data.tar.gz: 003b0d345c5f1ccc22361ddce4213e40054ec57a7e3404ca8d99ce3b120fb072b506a75f1fe64053e7b57c67688ed0b6aa6532dd99f3f7bfaa729c520d2c290c
6
+ metadata.gz: 3e43cbef4ba85e84265f10b9414eba95c92aeb59792a40318e15df37313ee5a6b99ce3c3e3e89d465c56e40fff92e61ed4115766d59b6ee9147c2d2c5920ebf7
7
+ data.tar.gz: 2401fa3bf2d0f824d7da3cf2e01cc4c20fe740f26d2019f89554adbbc67fdc5c0f4fa65003e143391b14ea2466314db36852edd0ccefca8178f6545e3186170d
@@ -27,21 +27,23 @@ jobs:
27
27
  os:
28
28
  - ubuntu
29
29
  - macos
30
+ - windows
30
31
  ruby-version:
31
32
  - jruby-9.4
32
- - jruby-9.3
33
- - jruby-9.2
33
+ - 3.4
34
+ - 3.3
34
35
  - 3.2
35
36
  - 3.1
36
37
  - '3.0'
37
38
  - 2.7
38
- - 2.6
39
- - 2.5
39
+ exclude:
40
+ - os: windows
41
+ ruby-version: jruby-9.4
40
42
 
41
43
  needs:
42
44
  - lint
43
45
  steps:
44
- - uses: actions/checkout@v3
46
+ - uses: actions/checkout@v4
45
47
  - name: Set up Ruby ${{ matrix.ruby-version }}
46
48
  uses: ruby/setup-ruby@v1
47
49
  with:
@@ -49,8 +51,15 @@ jobs:
49
51
  ruby-version: ${{ matrix.ruby-version }}
50
52
  - name: Install dependencies
51
53
  run: bundle install
54
+ - name: Get test project semver
55
+ id: get_semver
56
+ shell: bash
57
+ run: |
58
+ semver=$(ruby echo_client_spec_version.rb)
59
+ echo "::set-output name=semver::$semver"
52
60
  - name: Download test cases
53
- run: git clone --depth 5 --branch v4.2.2 https://github.com/Unleash/client-specification.git client-specification
61
+ run: git clone --depth 5 --branch v${{ steps.get_semver.outputs.semver }} https://github.com/Unleash/client-specification.git client-specification
62
+ shell: bash
54
63
  - name: Run tests
55
64
  run: bundle exec rake
56
65
  env:
@@ -61,15 +70,6 @@ jobs:
61
70
  github-token: ${{ secrets.GITHUB_TOKEN }}
62
71
  flag-name: run-${{ matrix.test_number }}
63
72
  parallel: true
64
- - name: Notify Slack of pipeline completion
65
- uses: 8398a7/action-slack@v3
66
- if: ${{ github.event.pull_request.head.repo.full_name == github.event.pull_request.base.repo.full_name }}
67
- with:
68
- status: ${{ job.status }}
69
- text: Built on ${{ matrix.os }} - Ruby ${{ matrix.ruby-version }}
70
- fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
71
- env:
72
- SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
73
73
 
74
74
  finish:
75
75
  needs: test
data/.rubocop.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  # inherit_from: .rubocop_todo.yml
2
2
 
3
3
  AllCops:
4
- TargetRubyVersion: 2.5
4
+ TargetRubyVersion: 2.7
5
5
 
6
6
  Naming/PredicateName:
7
7
  AllowedMethods:
@@ -13,6 +13,8 @@ Metrics/ClassLength:
13
13
  Max: 135
14
14
  CountAsOne:
15
15
  - 'method_call'
16
+ Exclude:
17
+ - 'lib/unleash/feature_toggle.rb'
16
18
  Layout/LineLength:
17
19
  Max: 140
18
20
  Metrics/MethodLength:
@@ -125,6 +127,8 @@ Layout/BeginEndAlignment:
125
127
  Enabled: true
126
128
  Layout/EmptyLinesAroundAttributeAccessor:
127
129
  Enabled: true
130
+ Layout/FirstHashElementIndentation:
131
+ EnforcedStyle: consistent
128
132
  Layout/SpaceAroundMethodCallOperator:
129
133
  Enabled: true
130
134
  Layout/MultilineMethodCallIndentation:
data/CHANGELOG.md CHANGED
@@ -13,6 +13,147 @@ Note: These changes are not considered notable:
13
13
 
14
14
  ## [Unreleased]
15
15
 
16
+ ## [6.4.0] - 2025-08-12
17
+ ### Added
18
+ - Experimental streaming support
19
+
20
+ #### Changed
21
+ - SDK registration name
22
+ - base64 dependency version
23
+
24
+ ## [6.3.1] - 2025-05-27
25
+ ### Fixed
26
+ - Upgraded Yggdrasil engine to fix a memory leak in metrics.
27
+
28
+ ## [6.3.0] - 2025-04-22
29
+ ### Changed
30
+ - Updated `logger` dependency to `~> 1.6` in the gemspec to allow compatibility with logger versions above 1.6.
31
+
32
+ ## [6.2.1] - 2025-04-14
33
+ ### Fixed
34
+ - metrics sending no longer fails after 10 minutes
35
+
36
+ ## [6.2.0] - 2024-02-28
37
+ ### Added
38
+ - unleash-interval header (#236)
39
+ - connectionId in metrics and registration payload (#236)
40
+ - default interval changed from 10s to 15s (#236)
41
+ - update Yggdrasil engine (#228)
42
+ - delta API configuration option (#228)
43
+
44
+ ## [6.1.2] - 2024-01-30
45
+ ### Fixed
46
+ - drop x- header prefix (#229)
47
+
48
+ ## [6.1.1] - 2024-01-21
49
+ ### Fixed
50
+ - use existing sdk name convention (#226)
51
+
52
+ ## [6.1.0] - 2025-01-21
53
+ ### Added
54
+ - standardised client identification headers (#224)
55
+
56
+
57
+ ## [6.0.10] - 2024-12-19
58
+ ### Fixed
59
+ - Fixed an edge case issue where the client was failing to send metrics after 10 minutes of not having metrics (#219)
60
+
61
+ ## [6.0.9] - 2024-11-21
62
+ ### Fixed
63
+ - Fixed an issue where the server not sending the encoding would break file saving (#215)
64
+
65
+ ## [6.0.8] - 2024-11-13
66
+ ### Fixed
67
+ - Fixed an issue where the SDK running on aarch64 wouldn't load the binary correctly
68
+
69
+ ## [6.0.7] - 2024-10-24
70
+ #### Fixed
71
+ - Context object correctly dumps to JSON
72
+
73
+ ## [6.0.6] - 2024-10-23
74
+ #### Changed
75
+ - Upgrade core engine library to allow ffi version 1.16.3
76
+
77
+ ## [6.0.5] - 2024-09-25
78
+ #### Fixed
79
+ - Upgrade core engine library to support ARM on legacy Mac
80
+
81
+ ## [6.0.0] - 2024-09-25
82
+ #### Fixed
83
+ - Upgrade core engine library to support ARM on Linux
84
+
85
+ ## [6.0.0.pre] - 2024-09-25
86
+ #### Changed
87
+ - No longer possible to override built in strategies with custom strategies (#152)
88
+ - No longer possible to access built in strategy's objects, these are now native code (#152)
89
+ - Core of the SDK swapped for Yggdrasil engine (#152)
90
+
91
+ ## [5.1.1] - 2024-09-23
92
+ ### Fixed
93
+ - increased accuracy of rollout distribution (#200)
94
+
95
+ ## [5.1.0] - 2024-09-18
96
+ ### Added
97
+ - feature_enabled in variants (#197)
98
+
99
+ ### Fixed
100
+ - fix issue with strategy variant stickiness (#198)
101
+
102
+ ## [5.0.7] - 2024-09-04
103
+ ### Changed
104
+ - segments now work with variants (#194)
105
+
106
+ ## [5.0.6] - 2024-08-29
107
+ ### Changed
108
+ - do not fail when case insentive enabled while having a complex context object (#191)
109
+
110
+ ## [5.0.5] - 2024-07-31
111
+ ### Changed
112
+ - emit warning when overriding a built in strategy (#187)
113
+
114
+ ## [5.0.4] - 2024-07-15
115
+ ### Changed
116
+ - Reverted "feat: automatically generated instance_id (#179)" (#185)
117
+
118
+ ## [5.0.3] - 2024-07-10
119
+ ### Fixed
120
+ - Client spec version should be loaded without touching the gemspec
121
+
122
+ ## [5.0.2] - 2024-07-05
123
+ ### Changed
124
+ - metrics data now includes information about the core engine (#178)
125
+ - to_s method on the context object now includes current time (#175)
126
+ - drop support for MRI 2.5 and JRuby 9.2 (#174)
127
+ - current_time property on the context now handles DateTimes as well as strings (#173)
128
+
129
+ ## [5.0.1] - 2024-03-27
130
+ ### Changed
131
+ - make user-agent headers more descriptive (#168)
132
+
133
+ ### Fixed
134
+ - make client more resilient to non-conforming responses from `unleash-edge` (#162)
135
+ - while the unleash server provides always valid responses, (at least some versions of) unleash-edge can provide an unexpected JSON response (null instead of empty array).
136
+ - fixed the handling of the response, so we do not throw exceptions in this situation.
137
+
138
+ ## [5.0.0] - 2023-10-30
139
+ ### Added
140
+ - change seed for variantutils to ensure fair distribution (#160)
141
+ - client specification is [here](https://github.com/Unleash/client-specification/tree/v5.0.2/specifications)
142
+ - A new seed is introduced to ensure a fair distribution for variants, addressing the issue of skewed variant distribution due to using the same hash string for both gradual rollout and variant allocation.
143
+
144
+ ## [4.6.0] - 2023-10-16
145
+ ### Added
146
+ - dependant toggles (#155)
147
+ - client specification is [here](https://github.com/Unleash/client-specification/pull/63)
148
+
149
+ ## [4.5.0] - 2023-07-05
150
+ ### Added
151
+ - variants in strategies (#148)
152
+ - issue described here (#147)
153
+
154
+ ### Fixed
155
+ - groupId override for variants
156
+
16
157
  ## [4.4.4] - 2023-07-05
17
158
  ### Fixed
18
159
  - flexible rollout strategy without context (#146)
@@ -96,7 +237,12 @@ Note: These changes are not considered notable:
96
237
  - only send metrics if there is data to send. (#58)
97
238
  - in Client#get_variant() allow context and fallback_variant as nil (#51)
98
239
 
99
- [unreleased]: https://git1hub.com/unleash/unleash-client-ruby/compare/v4.4.3...HEAD
240
+ [unreleased]: https://github.com/unleash/unleash-client-ruby/compare/v5.0.1...HEAD
241
+ [5.0.1]: https://github.com/unleash/unleash-client-ruby/compare/v5.0.0...v5.0.1
242
+ [5.0.0]: https://github.com/unleash/unleash-client-ruby/compare/v4.6.0...v5.0.0
243
+ [4.6.0]: https://github.com/unleash/unleash-client-ruby/compare/v4.5.0...v4.6.0
244
+ [4.5.0]: https://github.com/unleash/unleash-client-ruby/compare/v4.4.4...v4.5.0
245
+ [4.4.4]: https://github.com/unleash/unleash-client-ruby/compare/v4.4.3...v4.4.4
100
246
  [4.4.3]: https://github.com/unleash/unleash-client-ruby/compare/v4.4.2...v4.4.3
101
247
  [4.4.2]: https://github.com/unleash/unleash-client-ruby/compare/v4.4.1...v4.4.2
102
248
  [4.4.1]: https://github.com/unleash/unleash-client-ruby/compare/v4.4.0...v4.4.1